| | |
| | | /** |
| | | * The `node:fs` module enables interacting with the file system in a |
| | | * way modeled on standard POSIX functions. |
| | | * |
| | | * To use the promise-based APIs: |
| | | * |
| | | * ```js |
| | | * import * as fs from 'node:fs/promises'; |
| | | * ``` |
| | | * |
| | | * To use the callback and sync APIs: |
| | | * |
| | | * ```js |
| | | * import * as fs from 'node:fs'; |
| | | * ``` |
| | | * |
| | | * All file system operations have synchronous, callback, and promise-based |
| | | * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM). |
| | | * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/fs.js) |
| | | */ |
| | | declare module "node:fs" { |
| | | import { NonSharedBuffer } from "node:buffer"; |
| | | import { Abortable, EventEmitter, InternalEventEmitter } from "node:events"; |
| | |
| | | * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. |
| | | */ |
| | | function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer; |
| | | interface DisposableTempDir extends AsyncDisposable { |
| | | interface DisposableTempDir extends Disposable { |
| | | /** |
| | | * The path of the created directory. |
| | | */ |
| | |
| | | /** |
| | | * A function which removes the created directory. |
| | | */ |
| | | remove(): Promise<void>; |
| | | remove(): void; |
| | | /** |
| | | * The same as `remove`. |
| | | */ |
| | | [Symbol.asyncDispose](): Promise<void>; |
| | | [Symbol.dispose](): void; |
| | | } |
| | | /** |
| | | * Returns a disposable object whose `path` property holds the created directory |
| | |
| | | */ |
| | | function unwatchFile(filename: PathLike, listener?: StatsListener): void; |
| | | function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void; |
| | | type WatchIgnorePredicate = string | RegExp | ((filename: string) => boolean); |
| | | interface WatchOptions extends Abortable { |
| | | encoding?: BufferEncoding | "buffer" | undefined; |
| | | persistent?: boolean | undefined; |
| | | recursive?: boolean | undefined; |
| | | ignore?: WatchIgnorePredicate | readonly WatchIgnorePredicate[] | undefined; |
| | | } |
| | | interface WatchOptionsWithBufferEncoding extends WatchOptions { |
| | | encoding: "buffer"; |