eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
66 lines (65 loc) • 1.61 kB
TypeScript
import { Readable } from "stream";
//#region src/api-client/file-writer.d.ts
interface FileData {
/**
* The name (path) of the file to write.
*/
name: string;
/**
* The content of the file.
*/
content: string | Uint8Array;
/**
* The file mode (permissions) to set on the file.
* For example, 0o755 for executable files.
*/
mode?: number;
}
interface FileStream {
/**
* The name (path) of the file to write.
*/
name: string;
/**
* A Readable stream to consume the content of the file.
*/
content: Readable;
/**
* The expected size of the file. This is required to write
* the header of the compressed file.
*/
size: number;
/**
* The file mode (permissions) to set on the file.
* For example, 0o755 for executable files.
*/
mode?: number;
}
/**
* Allows to create a Readable stream with methods to write files
* to it and to finish it. Files written are compressed together
* and gzipped in the stream.
*/
declare class FileWriter {
readable: Readable;
private pack;
constructor();
/**
* Allows to add a file to the stream. Size is required to write
* the tarball header so when content is a stream it must be
* provided.
*
* Returns a Promise resolved once the file is written in the
* stream.
*/
addFile(file: FileData | FileStream): Promise<void>;
/**
* Allows to finish the stream returning a Promise that will
* resolve once the readable is effectively closed or
* errored.
*/
end(): Promise<void>;
}
//#endregion
export { FileWriter };
//# sourceMappingURL=file-writer.d.ts.map