trigger.dev
Version:
A Command-Line Interface for Trigger.dev projects
36 lines (35 loc) • 2.23 kB
TypeScript
export declare function createFile(path: string, contents: string | NodeJS.ArrayBufferView): Promise<string>;
/**
* Sanitizes a hash to be safe for use as a filename.
* esbuild's hashes are base64-encoded and may contain `/` and `+` characters.
*/
export declare function sanitizeHashForFilename(hash: string): string;
/**
* Creates a file using a content-addressable store for deduplication.
* Files are stored by their content hash, so identical content is only stored once.
* The build directory gets a hardlink to the stored file.
*
* @param filePath - The destination path for the file
* @param contents - The file contents to write
* @param storeDir - The shared store directory for deduplication
* @param contentHash - The content hash (e.g., from esbuild's outputFile.hash)
* @returns The destination file path
*/
export declare function createFileWithStore(filePath: string, contents: string | NodeJS.ArrayBufferView, storeDir: string, contentHash: string): Promise<string>;
export declare function isDirectory(configPath: string): boolean;
export declare function pathExists(path: string): Promise<boolean>;
export declare function someFileExists(directory: string, filenames: string[]): Promise<boolean>;
export declare function removeFile(path: string): Promise<void>;
export declare function readFile(path: string): Promise<string>;
export declare function expandTilde(filePath: string): string;
export declare function readJSONFile(path: string): Promise<any>;
export declare function safeReadJSONFile(path: string): Promise<any>;
export declare function writeJSONFile(path: string, json: any, pretty?: boolean): Promise<void>;
export declare function safeWriteFile(path: string, contents: string): Promise<void>;
export declare function readJSONFileSync(path: string): any;
export declare function safeDeleteFileSync(path: string): void;
export declare function createTempDir(): Promise<string>;
export declare function safeReadTomlFile(path: string): Promise<unknown>;
export declare function writeTomlFile(path: string, toml: any): Promise<void>;
export declare function safeReadJSONCFile(path: string): Promise<unknown>;
export declare function writeJSONCFile(path: string, json: any): Promise<void>;