The fs module enables interacting with the file system in a way modeled on standard POSIX functions.

To use the promise-based APIs:

import * as fs from 'fs/promises';

To use the callback and sync APIs:

import * as fs from '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

References

Namespaces

Classes

Interfaces

Type Aliases

Functions

References

Re-exports BigIntStats
Re-exports Dirent
Re-exports MakeDirectoryOptions
Re-exports NoParamCallback
Re-exports ObjectEncodingOptions
Re-exports PathLike
Re-exports PathOrFileDescriptor
Re-exports RmOptions
Re-exports StatOptions
Re-exports StatSyncOptions
Re-exports Stats
Re-exports StatsBase
Re-exports WriteFileOptions