UNPKG

@push.rocks/smartfile

Version:

Provides comprehensive tools for efficient file management in Node.js using TypeScript, including handling streams, virtual directories, and various file operations.

29 lines (28 loc) 1.36 kB
import * as plugins from './plugins.js'; export declare const createReadStream: (pathArg: string) => plugins.fs.ReadStream; export declare const createWriteStream: (pathArg: string) => plugins.fs.WriteStream; export declare const processFile: (filePath: string, asyncFunc: (fileStream: plugins.stream.Readable) => Promise<void>) => Promise<void>; export declare const processDirectory: (directoryPath: string, asyncFunc: (fileStream: plugins.stream.Readable) => Promise<void>) => Promise<void>; /** * Checks if a file is ready to be streamed (exists and is not empty). */ export declare const isFileReadyForStreaming: (filePathArg: string) => Promise<boolean>; /** * Waits for a file to be ready for streaming (exists and is not empty). */ export declare const waitForFileToBeReadyForStreaming: (filePathArg: string) => Promise<void>; export declare class SmartReadStream extends plugins.stream.Readable { private watcher; private lastReadSize; private endTimeout; private filePath; private endDelay; private reading; constructor(filePath: string, endDelay?: number, opts?: plugins.stream.ReadableOptions); private startWatching; private resetEndTimeout; private checkForEnd; private cleanup; _read(size: number): void; _destroy(error: Error | null, callback: (error: Error | null) => void): void; }