@modern-js/runtime-utils
Version:
A Progressive React Framework for modern web development.
20 lines (19 loc) • 852 B
TypeScript
import type { Buffer } from 'buffer';
import Fs from '@modern-js/utils/fs-extra';
import type { Storage } from './storer/storage';
export declare class FileReader {
private storage;
private fs;
constructor(storage: Storage<Buffer | null>);
readFile(path: string, encoding?: 'utf-8'): Promise<string | null>;
readFile(path: string, encoding?: 'buffer'): Promise<Buffer | null>;
readFileFromSystem(path: string, encoding?: 'utf-8'): Promise<string | null>;
readFileFromSystem(path: string, encoding?: 'buffer'): Promise<Buffer | null>;
_readFileFactory(fs: typeof Fs): (path: string, encoding?: "utf-8" | "buffer") => Promise<string | Buffer | null>;
/**
* Clear the fileCache entriely.
*/
reset(fs?: typeof Fs): Promise<void>;
private encodingContent;
}
export declare const fileReader: FileReader;