/** * Finding a foreign command's files by name. * * `startCommand` runs a program that picks its own filenames (`ipatool` streams * into `__.ipa.tmp` and assembles the `.ipa` at the * end). The package cannot know those names up front, so the consumer declares * a prefix and the suffixes, and everything here selects by that pair. * * Used from the detached runner and from the host (`killDownload`, * `reconcile`), so it imports nothing but `node:*`. */ /** Files in `dir` whose name starts with `namePrefix` and ends with one of `suffixes`. */ export interface FileMatch { dir: string; /** * Required, never a substring match. Two concurrent downloads in one * directory are told apart by this alone: the first version of the consumer * matched on a bundle-id substring, and two downloads deleted each other's * partial. Include a separator (`"com.example.app_"`) so one prefix cannot * be the start of another's. */ namePrefix: string; suffixes: string[]; } /** * Reject a match that could select more than the caller meant. * * An empty prefix matches every file in the directory, which turns * `cleanupOnFailure` into "delete every `.tmp` here". A separator in it is not * a file name prefix and would silently match nothing. Thrown from * `startCommand`, before anything is spawned. */ export declare function assertFileMatch(match: FileMatch, label: string): void; /** The matching files, each joined onto `dir`. Missing or unreadable `dir` → none. */ export declare function matchingFiles(match: FileMatch): string[]; /** Size and mtime of each matching file, skipping any that vanished mid-scan. */ export declare function sampleFiles(match: FileMatch): { path: string; size: number; mtimeMs: number; }[]; /** Delete every matching file. Returns the paths that were removed. */ export declare function removeMatches(matches: readonly FileMatch[] | undefined): string[]; /** * Whether ANY process in the group led by `pid` is still running. * * The runner and the command it spawned share one process group, so this is * the test for "nothing can still be writing these files". Deleting a partial * while the command lives lets it recreate the file a moment later. */ export declare function groupAlive(pid: number): boolean; //# sourceMappingURL=command-files.d.ts.map