@stryke/fs
Version:
A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.
29 lines (28 loc) • 1.31 kB
TypeScript
/**
* Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.
*
* @param filePath - The path to the file to read.
* @returns The content of the file as an ArrayBuffer.
*/
export declare function readBufferFile(filePath: string): Promise<ArrayBuffer>;
/**
* Reads a file from the given path and returns its content as an ArrayBuffer. The file is expected to be located relative to the current directory of this module.
*
* @param filePath - The path to the file to read.
* @returns The content of the file as an ArrayBuffer.
*/
export declare function readBufferFileSync(filePath: string): ArrayBuffer;
/**
* Writes an ArrayBuffer to a file at the specified path.
*
* @param filePath - The path to the file where the data should be written.
* @param data - The ArrayBuffer containing the data to write.
*/
export declare function writeBufferFile(filePath: string, data: ArrayBuffer): Promise<void>;
/**
* Writes an ArrayBuffer to a file at the specified path.
*
* @param filePath - The path to the file where the data should be written.
* @param data - The ArrayBuffer containing the data to write.
*/
export declare function writeFileBufferSync(filePath: string, data: ArrayBuffer): void;