index.d.ts 822 B

1234567891011121314
  1. /// <reference types="node" />
  2. import { Callback, Data, Path, ReadOptions, WriteOptions } from './types';
  3. declare function readFile(filePath: Path, options: string | ReadOptions & {
  4. encoding: string;
  5. }): Promise<string>;
  6. declare function readFile(filePath: Path, options?: ReadOptions): Promise<Buffer>;
  7. declare function readFileSync(filePath: Path, options: string | ReadOptions & {
  8. encoding: string;
  9. }): string;
  10. declare function readFileSync(filePath: Path, options?: ReadOptions): Buffer;
  11. declare const writeFile: (filePath: Path, data: Data, options?: string | WriteOptions | Callback | undefined, callback?: Callback | undefined) => Promise<void>;
  12. declare const writeFileSync: (filePath: Path, data: Data, options?: string | WriteOptions) => void;
  13. export { readFile, readFileSync, writeFile, writeFileSync };