Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
sealed external interface BigIntOptions
Link copied to clipboard
sealed external interface BigIntStats : StatsBase<BigInt>
Link copied to clipboard
sealed external interface BigIntStatsFs : StatsFsBase<BigInt>
Link copied to clipboard
typealias BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) -> Unit
Link copied to clipboard
Link copied to clipboard
sealed external interface CopyOptions : CopyOptionsBase
Link copied to clipboard
sealed external interface CopyOptionsBase
Link copied to clipboard
sealed external interface CopySyncOptions : CopyOptionsBase
Link copied to clipboard
Link copied to clipboard
sealed external interface CreateReadStreamOptions
Link copied to clipboard
Link copied to clipboard
sealed external interface CreateWriteStreamOptions
Link copied to clipboard
external class Dir : AsyncIterable<Dirent>

A class representing a directory stream.

Link copied to clipboard
external class Dirent

A representation of a directory entry, which can be a file or a subdirectory within the directory, as returned by reading from an fs.Dir. The directory entry is a combination of the file name and file type pairs.

Link copied to clipboard
typealias EncodingOption = Any?
Link copied to clipboard
sealed external interface FileChangeInfo<T : Any>
Link copied to clipboard
sealed external interface FileHandle
Link copied to clipboard
Link copied to clipboard
sealed external interface FileHandleReadFileBufferAsyncOptions
Link copied to clipboard
sealed external interface FileHandleReadFileStringAsyncOptions
Link copied to clipboard
sealed external interface FileHandleStatBigIntOpts : StatOptions
Link copied to clipboard
sealed external interface FileHandleStatOpts : StatOptions
Link copied to clipboard
sealed external interface FileHandleWriteResultPayload<TBuffer : Uint8Array>
Link copied to clipboard
sealed external interface FileHandleWriteStringResultPayload
Link copied to clipboard
sealed external interface FileReadOptions<T : ArrayBufferView>
Link copied to clipboard
sealed external interface FileReadResult<T : ArrayBufferView>
Link copied to clipboard
sealed external interface FlagAndOpenMode
Link copied to clipboard
sealed external interface FSImplementation
Link copied to clipboard
sealed external interface FstatBigIntOptions : StatOptions
Link copied to clipboard
sealed external interface FstatOptions : StatOptions
Link copied to clipboard
sealed external interface FstatSyncBigIntOptions : StatOptions
Link copied to clipboard
sealed external interface FstatSyncOptions : StatOptions
Link copied to clipboard
sealed external interface FSWatcher : EventEmitter
Link copied to clipboard
sealed external interface FSWatcherEvent
Link copied to clipboard
sealed external interface GlobOptions
Link copied to clipboard
sealed external interface GlobOptionsWithFileTypes : GlobOptions
Link copied to clipboard
sealed external interface GlobOptionsWithoutFileTypes : GlobOptions
Link copied to clipboard
sealed external interface LstatBigIntOptions : StatOptions
Link copied to clipboard
sealed external interface LstatBigIntOpts : StatOptions
Link copied to clipboard
sealed external interface LstatOptions : StatOptions
Link copied to clipboard
sealed external interface LstatOpts : StatOptions
Link copied to clipboard
sealed external interface MakeDirectoryOptions
Link copied to clipboard
sealed external interface MkdirAsyncOptions : MakeDirectoryOptions
Link copied to clipboard
sealed external interface MkdirOptions : MakeDirectoryOptions
Link copied to clipboard
Link copied to clipboard
sealed external interface MkdirRecursiveOptions : MakeDirectoryOptions
Link copied to clipboard
sealed external interface MkdirSyncOptions : MakeDirectoryOptions
Link copied to clipboard
Link copied to clipboard
sealed external interface MkdtempOptions
Link copied to clipboard
typealias Mode = Any
Link copied to clipboard
typealias NoParamCallback = (err: ErrnoException?) -> Unit
Link copied to clipboard
external interface ObjectEncodingOptions
Link copied to clipboard
sealed external interface OpenAsBlobOptions
Link copied to clipboard
sealed external interface OpenDirOptions
Link copied to clipboard
typealias OpenMode = Any
Link copied to clipboard
typealias PathLike = Any

Valid types for path values in "fs".

Link copied to clipboard
Link copied to clipboard
sealed external interface ReadableWebStreamOptions
Link copied to clipboard
Link copied to clipboard
sealed external interface ReaddirAsyncOptions : ObjectEncodingOptions
Link copied to clipboard
sealed external interface ReaddirBufferAsyncOptions
Link copied to clipboard
sealed external interface ReaddirBufferOptions
Link copied to clipboard
sealed external interface ReaddirOptions : ObjectEncodingOptions
Link copied to clipboard
sealed external interface ReaddirStringOptions
Link copied to clipboard
sealed external interface ReaddirSyncBufferOptions
Link copied to clipboard
sealed external interface ReaddirSyncOptions : ObjectEncodingOptions
Link copied to clipboard
sealed external interface ReaddirSyncStringOptions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
sealed external interface ReadFileBufferAsyncOptions : Abortable
Link copied to clipboard
sealed external interface ReadFileBufferOptions : Abortable
Link copied to clipboard
sealed external interface ReadFileOptions : ObjectEncodingOptions, Abortable
Link copied to clipboard
sealed external interface ReadFileStringAsyncOptions : Abortable
Link copied to clipboard
sealed external interface ReadFileStringOptions : Abortable
Link copied to clipboard
sealed external interface ReadFileSyncBufferOptions
Link copied to clipboard
sealed external interface ReadFileSyncOptions : ObjectEncodingOptions
Link copied to clipboard
sealed external interface ReadFileSyncStringOptions
Link copied to clipboard
typealias ReadPosition = Any
Link copied to clipboard
external class ReadStream : Readable

Instances of fs.ReadStream are created and returned using the {@link createReadStream} function.

Link copied to clipboard
sealed external interface ReadStreamEvent
Link copied to clipboard
sealed external interface ReadStreamOptions : StreamOptions
Link copied to clipboard
sealed external interface ReadSyncOptions
Link copied to clipboard
sealed external interface ReadVResult
Link copied to clipboard
sealed external interface RmDirOptions
Link copied to clipboard
sealed external interface RmOptions
Link copied to clipboard
sealed external interface StatBigIntOptions : StatOptions
Link copied to clipboard
sealed external interface StatBigIntOpts : StatOptions
Link copied to clipboard
sealed external interface StatfsBigIntOptions : StatFsOptions
Link copied to clipboard
sealed external interface StatfsBigIntOpts : StatFsOptions
Link copied to clipboard
sealed external interface StatFsOptions
Link copied to clipboard
sealed external interface StatfsOptions : StatFsOptions
Link copied to clipboard
sealed external interface StatfsOpts : StatFsOptions
Link copied to clipboard
sealed external interface StatfsSyncBigIntOptions : StatFsOptions
Link copied to clipboard
sealed external interface StatfsSyncOptions : StatFsOptions
Link copied to clipboard
sealed external interface StatOptions
Link copied to clipboard
external class Stats : StatsBase<Double>

A fs.Stats object provides information about a file.

Link copied to clipboard
sealed external interface StatsBase<T>
Link copied to clipboard
external class StatsFs : StatsFsBase<Double>

Provides information about a mounted file system.

Link copied to clipboard
sealed external interface StatsFsBase<T>
Link copied to clipboard
sealed external interface StatSimpleOptions : StatOptions
Link copied to clipboard
sealed external interface StatSimpleOpts : StatOptions
Link copied to clipboard
typealias StatsListener = (curr: Stats, prev: Stats) -> Unit
Link copied to clipboard
sealed external interface StatSyncFn
Link copied to clipboard
sealed external interface StatSyncFnBigIntOptions : StatSyncOptions
Link copied to clipboard
sealed external interface StatSyncFnOptions : StatSyncOptions
Link copied to clipboard
sealed external interface StatSyncFnSimpleOptions : StatSyncOptions
Link copied to clipboard
sealed external interface StatSyncOptions : StatOptions
Link copied to clipboard
sealed external interface StatWatcher : EventEmitter

Class: fs.StatWatcher

Link copied to clipboard
sealed external interface StreamOptions
Link copied to clipboard
sealed external interface SymlinkType
Link copied to clipboard
typealias TimeLike = Any
Link copied to clipboard
sealed external interface WatchBufferAsyncOptions : WatchOptions
Link copied to clipboard
sealed external interface WatchBufferOptions : WatchOptions
Link copied to clipboard
sealed external interface WatchEventType
Link copied to clipboard
sealed external interface WatchFileBigIntOptions : WatchFileOptions
Link copied to clipboard
sealed external interface WatchFileOptions

Watch for changes on filename. The callback listener will be called each time the file is accessed.

Link copied to clipboard
sealed external interface WatchFileSimpleOptions : WatchFileOptions
Link copied to clipboard
typealias WatchListener<T> = (event: WatchEventType, filename: T?) -> Unit
Link copied to clipboard
sealed external interface WatchOptions : Abortable
Link copied to clipboard
Link copied to clipboard
typealias WriteFileOptions = Any?
Link copied to clipboard
external class WriteStream : Writable

Instances of fs.WriteStream are created and returned using the {@link createWriteStream} function.

Link copied to clipboard
sealed external interface WriteStreamEvent
Link copied to clipboard
sealed external interface WriteStreamOptions : StreamOptions
Link copied to clipboard
sealed external interface WriteVResult

Properties

Link copied to clipboard
external val constants: Any?
Link copied to clipboard
external val lstatSync: StatSyncFn

Synchronous lstat(2) - Get file status. Does not dereference symbolic links.

Link copied to clipboard
external val statSync: StatSyncFn

Synchronous stat(2) - Get file status.

Functions

Link copied to clipboard
external fun access(path: PathLike, callback: NoParamCallback)

Asynchronously tests a user's permissions for the file specified by path.

suspend fun access(path: PathLike, mode: Number = undefined.unsafeCast<Nothing>()): Void

external fun access(path: PathLike, mode: Double?, callback: NoParamCallback)

Tests a user's permissions for the file or directory specified by path. The mode argument is an optional integer that specifies the accessibility checks to be performed. mode should be either the value fs.constants.F_OK or a mask consisting of the bitwise OR of any of fs.constants.R_OK, fs.constants.W_OK, and fs.constants.X_OK (e.g.fs.constants.W_OK | fs.constants.R_OK). Check File access constants for possible values of mode.

Link copied to clipboard
external fun accessAsync(path: PathLike, mode: Number = definedExternally): Promise<Void>

Tests a user's permissions for the file or directory specified by path. The mode argument is an optional integer that specifies the accessibility checks to be performed. mode should be either the value fs.constants.F_OK or a mask consisting of the bitwise OR of any of fs.constants.R_OK, fs.constants.W_OK, and fs.constants.X_OK (e.g.fs.constants.W_OK | fs.constants.R_OK). Check File access constants for possible values of mode.

Link copied to clipboard
external fun accessSync(path: PathLike, mode: Number = definedExternally)

Synchronously tests a user's permissions for the file or directory specified by path. The mode argument is an optional integer that specifies the accessibility checks to be performed. mode should be either the value fs.constants.F_OK or a mask consisting of the bitwise OR of any of fs.constants.R_OK, fs.constants.W_OK, and fs.constants.X_OK (e.g.fs.constants.W_OK | fs.constants.R_OK). Check File access constants for possible values of mode.

Link copied to clipboard
suspend fun appendFile(path: PathLike, data: Uint8Array): Void
suspend fun appendFile(path: FileHandle, data: Uint8Array): Void
suspend fun appendFile(path: FileHandle, data: String): Void
suspend fun appendFile(path: PathLike, data: Uint8Array, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun appendFile(path: PathLike, data: Uint8Array, options: AppendFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun appendFile(path: PathLike, data: String, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun appendFile(path: PathLike, data: String, options: AppendFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun appendFile(path: FileHandle, data: Uint8Array, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun appendFile(path: FileHandle, data: Uint8Array, options: AppendFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun appendFile(path: FileHandle, data: String, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun appendFile(path: FileHandle, data: String, options: AppendFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
external fun appendFile(path: PathOrFileDescriptor, data: Uint8Array, options: WriteFileOptions, callback: NoParamCallback)
external fun appendFile(path: PathOrFileDescriptor, data: String, options: WriteFileOptions, callback: NoParamCallback)

Asynchronously append data to a file, creating the file if it does not yet exist. data can be a string or a Buffer.

suspend fun appendFile(path: PathLike, data: String): Void

external fun appendFile(file: PathOrFileDescriptor, data: Uint8Array, callback: NoParamCallback)
external fun appendFile(file: PathOrFileDescriptor, data: String, callback: NoParamCallback)

Asynchronously append data to a file, creating the file if it does not exist.

Link copied to clipboard
external fun appendFileAsync(path: PathLike, data: Uint8Array): Promise<Void>
external fun appendFileAsync(path: PathLike, data: String): Promise<Void>
external fun appendFileAsync(path: FileHandle, data: Uint8Array): Promise<Void>
external fun appendFileAsync(path: FileHandle, data: String): Promise<Void>
external fun appendFileAsync(path: PathLike, data: Uint8Array, options: BufferEncoding? = definedExternally): Promise<Void>
external fun appendFileAsync(path: PathLike, data: Uint8Array, options: AppendFileAsyncOptions? = definedExternally): Promise<Void>
external fun appendFileAsync(path: PathLike, data: String, options: BufferEncoding? = definedExternally): Promise<Void>
external fun appendFileAsync(path: PathLike, data: String, options: AppendFileAsyncOptions? = definedExternally): Promise<Void>
external fun appendFileAsync(path: FileHandle, data: Uint8Array, options: BufferEncoding? = definedExternally): Promise<Void>
external fun appendFileAsync(path: FileHandle, data: Uint8Array, options: AppendFileAsyncOptions? = definedExternally): Promise<Void>
external fun appendFileAsync(path: FileHandle, data: String, options: BufferEncoding? = definedExternally): Promise<Void>
external fun appendFileAsync(path: FileHandle, data: String, options: AppendFileAsyncOptions? = definedExternally): Promise<Void>

Asynchronously append data to a file, creating the file if it does not yet exist. data can be a string or a Buffer.

Link copied to clipboard
external fun appendFileSync(path: PathOrFileDescriptor, data: Uint8Array, options: WriteFileOptions = definedExternally)
external fun appendFileSync(path: PathOrFileDescriptor, data: String, options: WriteFileOptions = definedExternally)

Synchronously append data to a file, creating the file if it does not yet exist. data can be a string or a Buffer.

Link copied to clipboard
suspend fun chmod(path: PathLike, mode: Mode): Void

external fun chmod(path: PathLike, mode: Mode, callback: NoParamCallback)

Asynchronously changes the permissions of a file. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun chmodAsync(path: PathLike, mode: Mode): Promise<Void>

Changes the permissions of a file.

Link copied to clipboard
external fun chmodSync(path: PathLike, mode: Mode)

For detailed information, see the documentation of the asynchronous version of this API: {@link chmod}.

Link copied to clipboard
suspend fun chown(path: PathLike, uid: Number, gid: Number): Void

external fun chown(path: PathLike, uid: Number, gid: Number, callback: NoParamCallback)

Asynchronously changes owner and group of a file. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun chownAsync(path: PathLike, uid: Number, gid: Number): Promise<Void>

Changes the ownership of a file.

Link copied to clipboard
external fun chownSync(path: PathLike, uid: Number, gid: Number)

Synchronously changes owner and group of a file. Returns undefined. This is the synchronous version of {@link chown}.

Link copied to clipboard
external fun close(fd: Number, callback: NoParamCallback = definedExternally)

Closes the file descriptor. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun closeSync(fd: Number)

Closes the file descriptor. Returns undefined.

Link copied to clipboard
external fun copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback)

Asynchronously copies src to dest. By default, dest is overwritten if it already exists. No arguments other than a possible exception are given to the callback function. Node.js makes no guarantees about the atomicity of the copy operation. If an error occurs after the destination file has been opened for writing, Node.js will attempt to remove the destination.

suspend fun copyFile(src: PathLike, dest: PathLike, mode: Number = undefined.unsafeCast<Nothing>()): Void
external fun copyFile(src: PathLike, dest: PathLike, mode: Number, callback: NoParamCallback)
Link copied to clipboard
external fun copyFileAsync(src: PathLike, dest: PathLike, mode: Number = definedExternally): Promise<Void>

Asynchronously copies src to dest. By default, dest is overwritten if it already exists.

Link copied to clipboard
external fun copyFileSync(src: PathLike, dest: PathLike, mode: Number = definedExternally)

Synchronously copies src to dest. By default, dest is overwritten if it already exists. Returns undefined. Node.js makes no guarantees about the atomicity of the copy operation. If an error occurs after the destination file has been opened for writing, Node.js will attempt to remove the destination.

Link copied to clipboard
external fun cp(source: String, destination: String, callback: (err: ErrnoException?) -> Unit)
external fun cp(source: String, destination: URL, callback: (err: ErrnoException?) -> Unit)
suspend fun cp(source: String, destination: URL, opts: CopyOptions = undefined.unsafeCast<Nothing>()): Void
external fun cp(source: URL, destination: String, callback: (err: ErrnoException?) -> Unit)
suspend fun cp(source: URL, destination: String, opts: CopyOptions = undefined.unsafeCast<Nothing>()): Void
external fun cp(source: URL, destination: URL, callback: (err: ErrnoException?) -> Unit)
suspend fun cp(source: URL, destination: URL, opts: CopyOptions = undefined.unsafeCast<Nothing>()): Void

Asynchronously copies the entire directory structure from src to dest, including subdirectories and files.

suspend fun cp(source: String, destination: String, opts: CopyOptions = undefined.unsafeCast<Nothing>()): Void
external fun cp(source: String, destination: String, opts: CopyOptions, callback: (err: ErrnoException?) -> Unit)
external fun cp(source: String, destination: URL, opts: CopyOptions, callback: (err: ErrnoException?) -> Unit)
external fun cp(source: URL, destination: String, opts: CopyOptions, callback: (err: ErrnoException?) -> Unit)
external fun cp(source: URL, destination: URL, opts: CopyOptions, callback: (err: ErrnoException?) -> Unit)
Link copied to clipboard
external fun cpAsync(source: String, destination: String, opts: CopyOptions = definedExternally): Promise<Void>
external fun cpAsync(source: String, destination: URL, opts: CopyOptions = definedExternally): Promise<Void>
external fun cpAsync(source: URL, destination: String, opts: CopyOptions = definedExternally): Promise<Void>
external fun cpAsync(source: URL, destination: URL, opts: CopyOptions = definedExternally): Promise<Void>

Asynchronously copies the entire directory structure from src to dest, including subdirectories and files.

Link copied to clipboard
external fun cpSync(source: String, destination: String, opts: CopySyncOptions = definedExternally)
external fun cpSync(source: String, destination: URL, opts: CopySyncOptions = definedExternally)
external fun cpSync(source: URL, destination: String, opts: CopySyncOptions = definedExternally)
external fun cpSync(source: URL, destination: URL, opts: CopySyncOptions = definedExternally)

Synchronously copies the entire directory structure from src to dest, including subdirectories and files.

Link copied to clipboard
external fun createReadStream(path: PathLike): ReadStream
external fun createReadStream(path: PathLike, options: BufferEncoding = definedExternally): ReadStream
external fun createReadStream(path: PathLike, options: ReadStreamOptions = definedExternally): ReadStream

Unlike the 16 KiB default highWaterMark for a stream.Readable, the stream returned by this method has a default highWaterMark of 64 KiB.

Link copied to clipboard
external fun createWriteStream(path: PathLike, options: BufferEncoding = definedExternally): WriteStream
external fun createWriteStream(path: PathLike, options: WriteStreamOptions = definedExternally): WriteStream

options may also include a start option to allow writing data at some position past the beginning of the file, allowed values are in the \[0, Number.MAX_SAFE_INTEGER\] range. Modifying a file rather than replacing it may require the flags option to be set to r+ rather than the default w. The encoding can be any one of those accepted by Buffer.

Link copied to clipboard
suspend fun exists(path: PathLike): Boolean

Returns true if the path exists, false otherwise.

external fun exists(path: PathLike, callback: (exists: Boolean) -> Unit)

Test whether or not the given path exists by checking with the file system. Then call the callback argument with either true or false:

Link copied to clipboard

Returns true if the path exists, false otherwise.

Link copied to clipboard
external fun existsSync(path: PathLike): Boolean

Returns true if the path exists, false otherwise.

Link copied to clipboard
external fun fchmod(fd: Number, mode: Mode, callback: NoParamCallback)

Sets the permissions on the file. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun fchmodSync(fd: Number, mode: Mode)

Sets the permissions on the file. Returns undefined.

Link copied to clipboard
external fun fchown(fd: Number, uid: Number, gid: Number, callback: NoParamCallback)

Sets the owner of the file. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun fchownSync(fd: Number, uid: Number, gid: Number)

Sets the owner of the file. Returns undefined.

Link copied to clipboard
external fun fdatasync(fd: Number, callback: NoParamCallback)

Forces all currently queued I/O operations associated with the file to the operating system's synchronized I/O completion state. Refer to the POSIX fdatasync(2) documentation for details. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun fdatasyncSync(fd: Number)

Forces all currently queued I/O operations associated with the file to the operating system's synchronized I/O completion state. Refer to the POSIX fdatasync(2) documentation for details. Returns undefined.

Link copied to clipboard
external fun fstat(fd: Number, callback: (err: ErrnoException?, stats: Stats) -> Unit)

Invokes the callback with the fs.Stats for the file descriptor.

external fun fstat(fd: Number, options: FstatBigIntOptions, callback: (err: ErrnoException?, stats: BigIntStats) -> Unit)
external fun fstat(fd: Number, options: FstatOptions?, callback: (err: ErrnoException?, stats: Stats) -> Unit)
external fun fstat(fd: Number, options: StatOptions?, callback: (err: ErrnoException?, stats: Any) -> Unit)
Link copied to clipboard
external fun fstatSync(fd: Number): Stats
external fun fstatSync(fd: Number, options: FstatSyncBigIntOptions): BigIntStats
external fun fstatSync(fd: Number, options: StatOptions = definedExternally): Any

external fun fstatSync(fd: Number, options: FstatSyncOptions = definedExternally): Stats

Retrieves the fs.Stats for the file descriptor.

Link copied to clipboard
external fun fsync(fd: Number, callback: NoParamCallback)

Request that all data for the open file descriptor is flushed to the storage device. The specific implementation is operating system and device specific. Refer to the POSIX fsync(2) documentation for more detail. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun fsyncSync(fd: Number)

Request that all data for the open file descriptor is flushed to the storage device. The specific implementation is operating system and device specific. Refer to the POSIX fsync(2) documentation for more detail. Returns undefined.

Link copied to clipboard
external fun ftruncate(fd: Number, callback: NoParamCallback)

Asynchronous ftruncate(2) - Truncate a file to a specified length.

external fun ftruncate(fd: Number, len: Double?, callback: NoParamCallback)

Truncates the file descriptor. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun ftruncateSync(fd: Number, len: Double? = definedExternally)

Truncates the file descriptor. Returns undefined.

Link copied to clipboard
external fun futimes(fd: Number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback)

Change the file system timestamps of the object referenced by the supplied file descriptor. See {@link utimes}.

Link copied to clipboard
external fun futimesSync(fd: Number, atime: TimeLike, mtime: TimeLike)

Synchronous version of {@link futimes}. Returns undefined.

Link copied to clipboard
external fun glob(pattern: ReadonlyArray<String>): AsyncIterator<String>
external fun glob(pattern: String): AsyncIterator<String>
external fun glob(pattern: ReadonlyArray<String>, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)
external fun glob(pattern: String, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)

Retrieves the files matching the specified pattern.

external fun glob(pattern: ReadonlyArray<String>, opt: GlobOptions): Any
external fun glob(pattern: String, opt: GlobOptions): Any
external fun glob(pattern: ReadonlyArray<String>, options: GlobOptions, callback: (err: ErrnoException?, matches: Any) -> Unit)
external fun glob(pattern: ReadonlyArray<String>, options: GlobOptionsWithFileTypes, callback: (err: ErrnoException?, ReadonlyArray<Dirent>) -> Unit)
external fun glob(pattern: ReadonlyArray<String>, options: GlobOptionsWithoutFileTypes, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)
external fun glob(pattern: String, options: GlobOptions, callback: (err: ErrnoException?, matches: Any) -> Unit)
external fun glob(pattern: String, options: GlobOptionsWithFileTypes, callback: (err: ErrnoException?, ReadonlyArray<Dirent>) -> Unit)
external fun glob(pattern: String, options: GlobOptionsWithoutFileTypes, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)
Link copied to clipboard
external fun globSync(pattern: String): ReadonlyArray<String>

Retrieves the files matching the specified pattern.

external fun globSync(pattern: ReadonlyArray<String>, options: GlobOptions): Any
external fun globSync(pattern: String, options: GlobOptions): Any
external fun globSync(pattern: String, options: GlobOptionsWithFileTypes): ReadonlyArray<Dirent>
Link copied to clipboard
suspend fun lchmod(path: PathLike, mode: Mode): Void

external fun lchmod(path: PathLike, mode: Mode, callback: NoParamCallback)

Changes the permissions on a symbolic link. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun lchmodAsync(path: PathLike, mode: Mode): Promise<Void>

Changes the permissions on a symbolic link.

Link copied to clipboard
external fun lchmodSync(path: PathLike, mode: Mode)

Changes the permissions on a symbolic link. Returns undefined.

Link copied to clipboard
suspend fun lchown(path: PathLike, uid: Number, gid: Number): Void

external fun lchown(path: PathLike, uid: Number, gid: Number, callback: NoParamCallback)

Set the owner of the symbolic link. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun lchownAsync(path: PathLike, uid: Number, gid: Number): Promise<Void>

Changes the ownership on a symbolic link.

Link copied to clipboard
external fun lchownSync(path: PathLike, uid: Number, gid: Number)

Set the owner for the path. Returns undefined.

Link copied to clipboard
suspend fun link(existingPath: PathLike, newPath: PathLike): Void

external fun link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback)

Creates a new link from the existingPath to the newPath. See the POSIX link(2) documentation for more detail. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun linkAsync(existingPath: PathLike, newPath: PathLike): Promise<Void>

Creates a new link from the existingPath to the newPath. See the POSIX link(2) documentation for more detail.

Link copied to clipboard
external fun linkSync(existingPath: PathLike, newPath: PathLike)

Creates a new link from the existingPath to the newPath. See the POSIX link(2) documentation for more detail. Returns undefined.

Link copied to clipboard
suspend fun lstat(path: PathLike): Stats
suspend fun lstat(path: PathLike, opts: LstatBigIntOpts): BigIntStats
suspend fun lstat(path: PathLike, opts: LstatOpts = undefined.unsafeCast<Nothing>()): Stats
suspend fun lstat(path: PathLike, opts: StatOptions = undefined.unsafeCast<Nothing>()): Any
external fun lstat(path: PathLike, options: LstatBigIntOptions, callback: (err: ErrnoException?, stats: BigIntStats) -> Unit)
external fun lstat(path: PathLike, options: LstatOptions?, callback: (err: ErrnoException?, stats: Stats) -> Unit)
external fun lstat(path: PathLike, options: StatOptions?, callback: (err: ErrnoException?, stats: Any) -> Unit)

external fun lstat(path: PathLike, callback: (err: ErrnoException?, stats: Stats) -> Unit)

Retrieves the fs.Stats for the symbolic link referred to by the path. The callback gets two arguments (err, stats) where stats is a fs.Stats object. lstat() is identical to stat(), except that if path is a symbolic link, then the link itself is stat-ed, not the file that it refers to.

Link copied to clipboard
external fun lstatAsync(path: PathLike): Promise<Stats>
external fun lstatAsync(path: PathLike, opts: StatOptions = definedExternally): Promise<Any>

external fun lstatAsync(path: PathLike, opts: LstatOpts = definedExternally): Promise<Stats>

Equivalent to fsPromises.stat() unless path refers to a symbolic link, in which case the link itself is stat-ed, not the file that it refers to. Refer to the POSIX lstat(2) document for more detail.

Link copied to clipboard
suspend fun lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Void

external fun lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback)

Changes the access and modification times of a file in the same way as {@link utimes}, with the difference that if the path refers to a symbolic link, then the link is not dereferenced: instead, the timestamps of the symbolic link itself are changed.

Link copied to clipboard
external fun lutimesAsync(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<Void>

Changes the access and modification times of a file in the same way as fsPromises.utimes(), with the difference that if the path refers to a symbolic link, then the link is not dereferenced: instead, the timestamps of the symbolic link itself are changed.

Link copied to clipboard
external fun lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike)

Change the file system timestamps of the symbolic link referenced by path. Returns undefined, or throws an exception when parameters are incorrect or the operation fails. This is the synchronous version of {@link lutimes}.

Link copied to clipboard
suspend fun mkdir(path: PathLike): Void
suspend fun mkdir(path: PathLike, options: MkdirRecursiveAsyncOptions): String?

suspend fun mkdir(path: PathLike, options: Mode? = undefined.unsafeCast<Nothing>()): Void
suspend fun mkdir(path: PathLike, options: MakeDirectoryOptions? = undefined.unsafeCast<Nothing>()): String?
suspend fun mkdir(path: PathLike, options: MkdirAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
external fun mkdir(path: PathLike, options: Mode?, callback: NoParamCallback)
external fun mkdir(path: PathLike, options: Mode?, callback: (err: ErrnoException?, path: String?) -> Unit)
external fun mkdir(path: PathLike, options: MakeDirectoryOptions?, callback: (err: ErrnoException?, path: String?) -> Unit)
external fun mkdir(path: PathLike, options: MkdirOptions?, callback: NoParamCallback)

Asynchronous mkdir(2) - create a directory.

external fun mkdir(path: PathLike, callback: NoParamCallback)

Asynchronous mkdir(2) - create a directory with a mode of 0o777.

external fun mkdir(path: PathLike, options: MkdirRecursiveOptions, callback: (err: ErrnoException?, path: String?) -> Unit)

Asynchronously creates a directory.

Link copied to clipboard
external fun mkdirAsync(path: PathLike): Promise<Void>
external fun mkdirAsync(path: PathLike, options: Mode? = definedExternally): Promise<Void>
external fun mkdirAsync(path: PathLike, options: MakeDirectoryOptions? = definedExternally): Promise<String?>
external fun mkdirAsync(path: PathLike, options: MkdirAsyncOptions? = definedExternally): Promise<Void>

Asynchronous mkdir(2) - create a directory.

Asynchronously creates a directory.

Link copied to clipboard
external fun mkdirSync(path: PathLike)
external fun mkdirSync(path: PathLike, options: Mode? = definedExternally)
external fun mkdirSync(path: PathLike, options: MakeDirectoryOptions? = definedExternally): String?
external fun mkdirSync(path: PathLike, options: MkdirSyncOptions? = definedExternally)

Synchronous mkdir(2) - create a directory.

external fun mkdirSync(path: PathLike, options: MkdirSyncRecursiveOptions): String?

Synchronously creates a directory. Returns undefined, or if recursive is true, the first directory path created. This is the synchronous version of {@link mkdir}.

Link copied to clipboard
suspend fun mkdtemp(prefix: String): String
suspend fun mkdtemp(prefix: String, options: BufferEncodingOption): Buffer

external fun mkdtemp(prefix: String, callback: (err: ErrnoException?, folder: String) -> Unit)
external fun mkdtemp(prefix: String, options: EncodingOption, callback: (err: ErrnoException?, folder: Any) -> Unit)
external fun mkdtemp(prefix: String, options: String, callback: (err: ErrnoException?, folder: Buffer) -> Unit)
external fun mkdtemp(prefix: String, options: MkdtempOptions, callback: (err: ErrnoException?, folder: Buffer) -> Unit)

Asynchronously creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.

suspend fun mkdtemp(prefix: String, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): String
suspend fun mkdtemp(prefix: String, options: ObjectEncodingOptions? = undefined.unsafeCast<Nothing>()): String

Creates a unique temporary directory. A unique directory name is generated by appending six random characters to the end of the provided prefix. Due to platform inconsistencies, avoid trailing X characters in prefix. Some platforms, notably the BSDs, can return more than six random characters, and replace trailing X characters in prefix with random characters.

external fun mkdtemp(prefix: String, options: EncodingOption, callback: (err: ErrnoException?, folder: String) -> Unit)

Creates a unique temporary directory.

Link copied to clipboard
external fun mkdtempAsync(prefix: String): Promise<String>
external fun mkdtempAsync(prefix: String, options: BufferEncoding? = definedExternally): Promise<String>
external fun mkdtempAsync(prefix: String, options: ObjectEncodingOptions? = definedExternally): Promise<String>

Creates a unique temporary directory. A unique directory name is generated by appending six random characters to the end of the provided prefix. Due to platform inconsistencies, avoid trailing X characters in prefix. Some platforms, notably the BSDs, can return more than six random characters, and replace trailing X characters in prefix with random characters.

external fun mkdtempAsync(prefix: String, options: BufferEncodingOption): Promise<Buffer>

Asynchronously creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.

Link copied to clipboard
external fun mkdtempSync(prefix: String): String
external fun mkdtempSync(prefix: String, options: BufferEncodingOption): Buffer

Synchronously creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.

external fun mkdtempSync(prefix: String, options: EncodingOption = definedExternally): String

Returns the created directory path.

Link copied to clipboard
suspend fun open(path: PathLike): FileHandle

external fun open(path: PathLike, callback: (err: ErrnoException?, fd: Double) -> Unit)
external fun open(path: PathLike, flags: OpenMode?, callback: (err: ErrnoException?, fd: Double) -> Unit)

Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be 0o666.

suspend fun open(path: PathLike, flags: Double = undefined.unsafeCast<Nothing>(), mode: Mode = undefined.unsafeCast<Nothing>()): FileHandle
suspend fun open(path: PathLike, flags: String = undefined.unsafeCast<Nothing>(), mode: Mode = undefined.unsafeCast<Nothing>()): FileHandle

Opens a FileHandle.

external fun open(path: PathLike, flags: OpenMode?, mode: Mode?, callback: (err: ErrnoException?, fd: Double) -> Unit)

Asynchronous file open. See the POSIX open(2) documentation for more details.

Link copied to clipboard
suspend fun openAsBlob(path: PathLike, options: OpenAsBlobOptions = undefined.unsafeCast<Nothing>()): Blob
Link copied to clipboard
external fun openAsBlobAsync(path: PathLike, options: OpenAsBlobOptions = definedExternally): Promise<Blob>

Returns a Blob whose data is backed by the given file.

Link copied to clipboard
external fun openAsync(path: PathLike): Promise<FileHandle>
external fun openAsync(path: PathLike, flags: Double = definedExternally, mode: Mode = definedExternally): Promise<FileHandle>
external fun openAsync(path: PathLike, flags: String = definedExternally, mode: Mode = definedExternally): Promise<FileHandle>

Opens a FileHandle.

Link copied to clipboard
external fun opendir(path: PathLike, cb: (err: ErrnoException?, dir: Dir) -> Unit)

Asynchronously open a directory. See the POSIX opendir(3) documentation for more details.

suspend fun opendir(path: PathLike, options: OpenDirOptions = undefined.unsafeCast<Nothing>()): Dir
external fun opendir(path: PathLike, options: OpenDirOptions, cb: (err: ErrnoException?, dir: Dir) -> Unit)
Link copied to clipboard
external fun opendirAsync(path: PathLike, options: OpenDirOptions = definedExternally): Promise<Dir>

Asynchronously open a directory for iterative scanning. See the POSIX opendir(3) documentation for more detail.

Link copied to clipboard
external fun opendirSync(path: PathLike, options: OpenDirOptions = definedExternally): Dir

Synchronously open a directory. See opendir(3).

Link copied to clipboard
external fun openSync(path: PathLike, flags: OpenMode, mode: Mode? = definedExternally): Double

Returns an integer representing the file descriptor.

Link copied to clipboard
external fun read(fd: Number, callback: (err: ErrnoException?, bytesRead: Double, buffer: ArrayBufferView) -> Unit)

external fun <TBuffer : ArrayBufferView> read(fd: Number, options: ReadAsyncOptions<TBuffer>, callback: (err: ErrnoException?, bytesRead: Double, buffer: TBuffer) -> Unit)

Similar to the above fs.read function, this version takes an optional options object. If not otherwise specified in an options object, buffer defaults to Buffer.alloc(16384), offset defaults to 0, length defaults to buffer.byteLength, - offset as of Node 17.6.0 position defaults to null

external fun <TBuffer : ArrayBufferView> read(fd: Number, buffer: TBuffer, offset: Number, length: Number, position: ReadPosition?, callback: (err: ErrnoException?, bytesRead: Double, buffer: TBuffer) -> Unit)

Read data from the file specified by fd.

Link copied to clipboard
suspend fun readdir(path: PathLike): ReadonlyArray<String>

external fun readdir(path: PathLike, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)
suspend fun readdir(path: PathLike, options: String): ReadonlyArray<Buffer>
external fun readdir(path: PathLike, options: String, callback: (err: ErrnoException?, ReadonlyArray<Buffer>) -> Unit)
external fun readdir(path: PathLike, options: BufferEncoding?, callback: (err: ErrnoException?, files: Any) -> Unit)
external fun readdir(path: PathLike, options: ReaddirBufferOptions, callback: (err: ErrnoException?, ReadonlyArray<Buffer>) -> Unit)
external fun readdir(path: PathLike, options: ReaddirOptions?, callback: (err: ErrnoException?, files: Any) -> Unit)
external fun readdir(path: PathLike, options: ReaddirWithFileTypesOptions, callback: (err: ErrnoException?, ReadonlyArray<Dirent>) -> Unit)

Asynchronous readdir(3) - read a directory.

suspend fun readdir(path: PathLike, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): ReadonlyArray<String>
suspend fun readdir(path: PathLike, options: ReaddirAsyncOptions? = undefined.unsafeCast<Nothing>()): ReadonlyArray<String>

Reads the contents of a directory.

external fun readdir(path: PathLike, options: BufferEncoding?, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)
external fun readdir(path: PathLike, options: ReaddirStringOptions?, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)

Reads the contents of a directory. The callback gets two arguments (err, files) where files is an array of the names of the files in the directory excluding '.' and '..'.

Link copied to clipboard
external fun readdirAsync(path: PathLike, options: BufferEncoding? = definedExternally): Promise<ReadonlyArray<String>>
external fun readdirAsync(path: PathLike, options: ReaddirAsyncOptions? = definedExternally): Promise<ReadonlyArray<String>>

Reads the contents of a directory.

external fun readdirAsync(path: PathLike, options: String): Promise<ReadonlyArray<Buffer>>

Asynchronous readdir(3) - read a directory.

Link copied to clipboard
external fun readdirSync(path: PathLike, options: BufferEncoding? = definedExternally): ReadonlyArray<String>
external fun readdirSync(path: PathLike, options: ReaddirSyncStringOptions? = definedExternally): ReadonlyArray<String>

Reads the contents of the directory.

external fun readdirSync(path: PathLike, options: String): ReadonlyArray<Buffer>
external fun readdirSync(path: PathLike, options: ReaddirSyncOptions? = definedExternally): Any

Synchronous readdir(3) - read a directory.

Link copied to clipboard
suspend fun readFile(path: PathLike): Any
suspend fun readFile(path: PathLike, options: ReadFileBufferAsyncOptions? = undefined.unsafeCast<Nothing>()): Buffer
suspend fun readFile(path: PathLike, options: ReadFileStringAsyncOptions): String

suspend fun readFile(path: FileHandle): Any
external fun readFile(path: PathOrFileDescriptor, callback: (err: ErrnoException?, data: Buffer) -> Unit)
suspend fun readFile(path: PathLike, options: BufferEncoding): String
suspend fun readFile(path: PathLike, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Any
suspend fun readFile(path: PathLike, options: ReadFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Any
suspend fun readFile(path: FileHandle, options: BufferEncoding): String
suspend fun readFile(path: FileHandle, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Any
suspend fun readFile(path: FileHandle, options: ReadFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Any
suspend fun readFile(path: FileHandle, options: ReadFileBufferAsyncOptions? = undefined.unsafeCast<Nothing>()): Buffer
external fun readFile(path: PathOrFileDescriptor, options: BufferEncoding, callback: (err: ErrnoException?, data: String) -> Unit)
external fun readFile(path: PathOrFileDescriptor, options: BufferEncoding?, callback: (err: ErrnoException?, data: Any) -> Unit)
external fun readFile(path: PathOrFileDescriptor, options: ReadFileBufferOptions?, callback: (err: ErrnoException?, data: Buffer) -> Unit)
external fun readFile(path: PathOrFileDescriptor, options: ReadFileOptions?, callback: (err: ErrnoException?, data: Any) -> Unit)
external fun readFile(path: PathOrFileDescriptor, options: ReadFileStringOptions, callback: (err: ErrnoException?, data: String) -> Unit)

Asynchronously reads the entire contents of a file.

Link copied to clipboard
external fun readFileAsync(path: PathLike): Promise<Any>
external fun readFileAsync(path: FileHandle): Promise<Any>
external fun readFileAsync(path: PathLike, options: BufferEncoding): Promise<String>
external fun readFileAsync(path: PathLike, options: BufferEncoding? = definedExternally): Promise<Any>
external fun readFileAsync(path: PathLike, options: ReadFileAsyncOptions? = definedExternally): Promise<Any>
external fun readFileAsync(path: PathLike, options: ReadFileBufferAsyncOptions? = definedExternally): Promise<Buffer>
external fun readFileAsync(path: FileHandle, options: BufferEncoding): Promise<String>
external fun readFileAsync(path: FileHandle, options: BufferEncoding? = definedExternally): Promise<Any>
external fun readFileAsync(path: FileHandle, options: ReadFileAsyncOptions? = definedExternally): Promise<Any>
external fun readFileAsync(path: FileHandle, options: ReadFileBufferAsyncOptions? = definedExternally): Promise<Buffer>

Asynchronously reads the entire contents of a file.

Link copied to clipboard
external fun readFileSync(path: PathOrFileDescriptor, options: BufferEncoding? = definedExternally): Any
external fun readFileSync(path: PathOrFileDescriptor, options: ReadFileSyncOptions? = definedExternally): Any

Synchronously reads the entire contents of a file.

external fun readFileSync(path: PathOrFileDescriptor, options: ReadFileSyncBufferOptions? = definedExternally): Buffer

Returns the contents of the path.

Link copied to clipboard
suspend fun readlink(path: PathLike): String
suspend fun readlink(path: PathLike, options: BufferEncodingOption): Buffer

external fun readlink(path: PathLike, callback: (err: ErrnoException?, linkString: String) -> Unit)
suspend fun readlink(path: PathLike, options: String? = undefined.unsafeCast<Nothing>()): Any
external fun readlink(path: PathLike, options: BufferEncodingOption, callback: (err: ErrnoException?, linkString: Buffer) -> Unit)
external fun readlink(path: PathLike, options: EncodingOption, callback: (err: ErrnoException?, linkString: Any) -> Unit)

Asynchronous readlink(2) - read value of a symbolic link.

suspend fun readlink(path: PathLike, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): String
suspend fun readlink(path: PathLike, options: ObjectEncodingOptions? = undefined.unsafeCast<Nothing>()): String

Reads the contents of the symbolic link referred to by path. See the POSIX readlink(2) documentation for more detail. The promise is fulfilled with thelinkString upon success.

external fun readlink(path: PathLike, options: EncodingOption, callback: (err: ErrnoException?, linkString: String) -> Unit)

Reads the contents of the symbolic link referred to by path. The callback gets two arguments (err, linkString).

Link copied to clipboard
external fun readlinkAsync(path: PathLike): Promise<String>
external fun readlinkAsync(path: PathLike, options: BufferEncoding? = definedExternally): Promise<String>
external fun readlinkAsync(path: PathLike, options: ObjectEncodingOptions? = definedExternally): Promise<String>

Reads the contents of the symbolic link referred to by path. See the POSIX readlink(2) documentation for more detail. The promise is fulfilled with thelinkString upon success.

external fun readlinkAsync(path: PathLike, options: BufferEncodingOption): Promise<Buffer>
external fun readlinkAsync(path: PathLike, options: String? = definedExternally): Promise<Any>

Asynchronous readlink(2) - read value of a symbolic link.

Link copied to clipboard
external fun readlinkSync(path: PathLike): String
external fun readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer

Synchronous readlink(2) - read value of a symbolic link.

external fun readlinkSync(path: PathLike, options: EncodingOption = definedExternally): String

Returns the symbolic link's string value.

Link copied to clipboard
external fun readSync(fd: Number, buffer: ArrayBufferView, opts: ReadSyncOptions = definedExternally): Double

Similar to the above fs.readSync function, this version takes an optional options object. If no options object is specified, it will default with the above values.

external fun readSync(fd: Number, buffer: ArrayBufferView, offset: Number, length: Number, position: ReadPosition?): Double

Returns the number of bytesRead.

Link copied to clipboard
external fun readv(fd: Number, buffers: ReadonlyArray<ArrayBufferView>, cb: (err: ErrnoException?, bytesRead: Double, ReadonlyArray<ArrayBufferView>) -> Unit)

Read from a file specified by fd and write to an array of ArrayBufferViews using readv().

external fun readv(fd: Number, buffers: ReadonlyArray<ArrayBufferView>, position: Number, cb: (err: ErrnoException?, bytesRead: Double, ReadonlyArray<ArrayBufferView>) -> Unit)
Link copied to clipboard
external fun readvSync(fd: Number, buffers: ReadonlyArray<ArrayBufferView>, position: Number = definedExternally): Double

For detailed information, see the documentation of the asynchronous version of this API: {@link readv}.

Link copied to clipboard
suspend fun realpath(path: PathLike): String
suspend fun realpath(path: PathLike, options: BufferEncodingOption): Buffer

external fun realpath(path: PathLike, callback: (err: ErrnoException?, resolvedPath: String) -> Unit)
external fun realpath(path: PathLike, options: BufferEncodingOption, callback: (err: ErrnoException?, resolvedPath: Buffer) -> Unit)
external fun realpath(path: PathLike, options: EncodingOption, callback: (err: ErrnoException?, resolvedPath: Any) -> Unit)

Asynchronous realpath(3) - return the canonicalized absolute pathname.

suspend fun realpath(path: PathLike, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): String
suspend fun realpath(path: PathLike, options: ObjectEncodingOptions? = undefined.unsafeCast<Nothing>()): String

Determines the actual location of path using the same semantics as the fs.realpath.native() function.

external fun realpath(path: PathLike, options: EncodingOption, callback: (err: ErrnoException?, resolvedPath: String) -> Unit)

Asynchronously computes the canonical pathname by resolving ., .., and symbolic links.

Link copied to clipboard
external fun realpathAsync(path: PathLike): Promise<String>
external fun realpathAsync(path: PathLike, options: BufferEncoding? = definedExternally): Promise<String>
external fun realpathAsync(path: PathLike, options: ObjectEncodingOptions? = definedExternally): Promise<String>

Determines the actual location of path using the same semantics as the fs.realpath.native() function.

external fun realpathAsync(path: PathLike, options: BufferEncodingOption): Promise<Buffer>

Asynchronous realpath(3) - return the canonicalized absolute pathname.

Link copied to clipboard
external fun realpathSync(path: PathLike): String
external fun realpathSync(path: PathLike, options: BufferEncodingOption): Buffer

Synchronous realpath(3) - return the canonicalized absolute pathname.

external fun realpathSync(path: PathLike, options: EncodingOption = definedExternally): String

Returns the resolved pathname.

Link copied to clipboard
suspend fun rename(oldPath: PathLike, newPath: PathLike): Void

external fun rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback)

Asynchronously rename file at oldPath to the pathname provided as newPath. In the case that newPath already exists, it will be overwritten. If there is a directory at newPath, an error will be raised instead. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun renameAsync(oldPath: PathLike, newPath: PathLike): Promise<Void>

Renames oldPath to newPath.

Link copied to clipboard
external fun renameSync(oldPath: PathLike, newPath: PathLike)

Renames the file from oldPath to newPath. Returns undefined.

Link copied to clipboard
external fun rm(path: PathLike, callback: NoParamCallback)

Asynchronously removes files and directories (modeled on the standard POSIX rm utility). No arguments other than a possible exception are given to the completion callback.

suspend fun rm(path: PathLike, options: RmOptions = undefined.unsafeCast<Nothing>()): Void
external fun rm(path: PathLike, options: RmOptions, callback: NoParamCallback)
Link copied to clipboard
external fun rmAsync(path: PathLike, options: RmOptions = definedExternally): Promise<Void>

Removes files and directories (modeled on the standard POSIX rm utility).

Link copied to clipboard
external fun rmdir(path: PathLike, callback: NoParamCallback)

Asynchronous rmdir(2). No arguments other than a possible exception are given to the completion callback.

suspend fun rmdir(path: PathLike, options: RmDirOptions = undefined.unsafeCast<Nothing>()): Void
external fun rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback)
Link copied to clipboard
external fun rmdirAsync(path: PathLike, options: RmDirOptions = definedExternally): Promise<Void>

Removes the directory identified by path.

Link copied to clipboard
external fun rmdirSync(path: PathLike, options: RmDirOptions = definedExternally)

Synchronous rmdir(2). Returns undefined.

Link copied to clipboard
external fun rmSync(path: PathLike, options: RmOptions = definedExternally)

Synchronously removes files and directories (modeled on the standard POSIX rm utility). Returns undefined.

Link copied to clipboard
suspend fun stat(path: PathLike): Stats
suspend fun stat(path: PathLike, opts: StatBigIntOpts): BigIntStats
suspend fun stat(path: PathLike, opts: StatOptions = undefined.unsafeCast<Nothing>()): Any
suspend fun stat(path: PathLike, opts: StatSimpleOpts = undefined.unsafeCast<Nothing>()): Stats
external fun stat(path: PathLike, options: StatBigIntOptions, callback: (err: ErrnoException?, stats: BigIntStats) -> Unit)
external fun stat(path: PathLike, options: StatOptions?, callback: (err: ErrnoException?, stats: Any) -> Unit)
external fun stat(path: PathLike, options: StatSimpleOptions?, callback: (err: ErrnoException?, stats: Stats) -> Unit)

external fun stat(path: PathLike, callback: (err: ErrnoException?, stats: Stats) -> Unit)

Asynchronous stat(2). The callback gets two arguments (err, stats) wherestats is an fs.Stats object.

Link copied to clipboard
external fun statAsync(path: PathLike): Promise<Stats>
external fun statAsync(path: PathLike, opts: StatBigIntOpts): Promise<BigIntStats>
external fun statAsync(path: PathLike, opts: StatOptions = definedExternally): Promise<Any>
external fun statAsync(path: PathLike, opts: StatSimpleOpts = definedExternally): Promise<Stats>
Link copied to clipboard
suspend fun statfs(path: PathLike): StatsFs
suspend fun statfs(path: PathLike, opts: StatFsOptions = undefined.unsafeCast<Nothing>()): Any
suspend fun statfs(path: PathLike, opts: StatfsBigIntOpts): BigIntStatsFs
suspend fun statfs(path: PathLike, opts: StatfsOpts = undefined.unsafeCast<Nothing>()): StatsFs
external fun statfs(path: PathLike, options: StatFsOptions?, callback: (err: ErrnoException?, stats: Any) -> Unit)
external fun statfs(path: PathLike, options: StatfsBigIntOptions, callback: (err: ErrnoException?, stats: BigIntStatsFs) -> Unit)
external fun statfs(path: PathLike, options: StatfsOptions?, callback: (err: ErrnoException?, stats: StatsFs) -> Unit)

external fun statfs(path: PathLike, callback: (err: ErrnoException?, stats: StatsFs) -> Unit)

Asynchronous statfs(2). Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where statsis an fs.StatFs object.

Link copied to clipboard
external fun statfsAsync(path: PathLike): Promise<StatsFs>
external fun statfsAsync(path: PathLike, opts: StatFsOptions = definedExternally): Promise<Any>
external fun statfsAsync(path: PathLike, opts: StatfsOpts = definedExternally): Promise<StatsFs>
Link copied to clipboard
external fun statfsSync(path: PathLike): StatsFs
external fun statfsSync(path: PathLike, options: StatFsOptions = definedExternally): Any

external fun statfsSync(path: PathLike, options: StatfsSyncOptions = definedExternally): StatsFs

Synchronous statfs(2). Returns information about the mounted file system which contains path.

Link copied to clipboard
external fun symlink(target: PathLike, path: PathLike, callback: NoParamCallback)

Asynchronous symlink(2) - Create a new symbolic link to an existing file.

suspend fun symlink(target: PathLike, path: PathLike, type: String? = undefined.unsafeCast<Nothing>()): Void

external fun symlink(target: PathLike, path: PathLike, type: SymlinkType?, callback: NoParamCallback)

Creates the link called path pointing to target. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun symlinkAsync(target: PathLike, path: PathLike, type: String? = definedExternally): Promise<Void>

Creates a symbolic link.

Link copied to clipboard
external fun symlinkSync(target: PathLike, path: PathLike, type: SymlinkType? = definedExternally)

Returns undefined.

Link copied to clipboard
external fun truncate(path: PathLike, callback: NoParamCallback)

Asynchronous truncate(2) - Truncate a file to a specified length.

suspend fun truncate(path: PathLike, len: Number = undefined.unsafeCast<Nothing>()): Void

external fun truncate(path: PathLike, len: Double?, callback: NoParamCallback)

Truncates the file. No arguments other than a possible exception are given to the completion callback. A file descriptor can also be passed as the first argument. In this case, fs.ftruncate() is called.

Link copied to clipboard
external fun truncateAsync(path: PathLike, len: Number = definedExternally): Promise<Void>

Truncates (shortens or extends the length) of the content at path to len bytes.

Link copied to clipboard
external fun truncateSync(path: PathLike, len: Double? = definedExternally)

Truncates the file. Returns undefined. A file descriptor can also be passed as the first argument. In this case, fs.ftruncateSync() is called.

Link copied to clipboard
suspend fun unlink(path: PathLike): Void

external fun unlink(path: PathLike, callback: NoParamCallback)

Asynchronously removes a file or symbolic link. No arguments other than a possible exception are given to the completion callback.

Link copied to clipboard
external fun unlinkAsync(path: PathLike): Promise<Void>

If path refers to a symbolic link, then the link is removed without affecting the file or directory to which that link refers. If the path refers to a file path that is not a symbolic link, the file is deleted. See the POSIX unlink(2) documentation for more detail.

Link copied to clipboard
external fun unlinkSync(path: PathLike)

Synchronous unlink(2). Returns undefined.

Link copied to clipboard
external fun unwatchFile(filename: PathLike)
external fun unwatchFile(filename: PathLike, listener: BigIntStatsListener = definedExternally)

external fun unwatchFile(filename: PathLike, listener: StatsListener = definedExternally)

Stop watching for changes on filename. If listener is specified, only that particular listener is removed. Otherwise, all listeners are removed, effectively stopping watching of filename.

Link copied to clipboard
suspend fun utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Void

external fun utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback)

Change the file system timestamps of the object referenced by path.

Link copied to clipboard
external fun utimesAsync(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<Void>

Change the file system timestamps of the object referenced by path.

Link copied to clipboard
external fun utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike)

Returns undefined.

Link copied to clipboard
external fun watch(filename: PathLike): AsyncIterable<FileChangeInfo<String>>
external fun watch(filename: PathLike, listener: WatchListener<String> = definedExternally): FSWatcher
external fun watch(filename: PathLike, options: String): Any
external fun watch(filename: PathLike, options: BufferEncoding = definedExternally): AsyncIterable<FileChangeInfo<String>>
external fun watch(filename: PathLike, options: WatchOptions = definedExternally): AsyncIterable<FileChangeInfo<String>>
external fun watch(filename: PathLike, options: String, listener: WatchListener<Any> = definedExternally): FSWatcher
external fun watch(filename: PathLike, options: BufferEncoding? = definedExternally, listener: WatchListener<String> = definedExternally): FSWatcher
external fun watch(filename: PathLike, options: WatchOptions, listener: WatchListener<Any> = definedExternally): FSWatcher
external fun watch(filename: PathLike, options: WatchOptions? = definedExternally, listener: WatchListener<String> = definedExternally): FSWatcher

Watch for changes on filename, where filename is either a file or a directory, returning an FSWatcher.

Returns an async iterator that watches for changes on filename, where filenameis either a file or a directory.

external fun watch(filename: PathLike, options: String, listener: WatchListener<Buffer> = definedExternally): FSWatcher
external fun watch(filename: PathLike, options: WatchBufferOptions, listener: WatchListener<Buffer> = definedExternally): FSWatcher

Watch for changes on filename, where filename is either a file or a directory.

Link copied to clipboard
external fun watchFile(filename: PathLike, listener: StatsListener): StatWatcher
external fun watchFile(filename: PathLike, options: WatchFileSimpleOptions?, listener: StatsListener): StatWatcher

Watch for changes on filename. The callback listener will be called each time the file is accessed.

external fun watchFile(filename: PathLike, options: WatchFileBigIntOptions?, listener: BigIntStatsListener): StatWatcher
Link copied to clipboard
external fun <TBuffer : ArrayBufferView> write(fd: Number, buffer: TBuffer, callback: (err: ErrnoException?, written: Double, buffer: TBuffer) -> Unit)
external fun <TBuffer : ArrayBufferView> write(fd: Number, buffer: TBuffer, offset: Double?, callback: (err: ErrnoException?, written: Double, buffer: TBuffer) -> Unit)
external fun <TBuffer : ArrayBufferView> write(fd: Number, buffer: TBuffer, offset: Double?, length: Double?, callback: (err: ErrnoException?, written: Double, buffer: TBuffer) -> Unit)

Asynchronously writes buffer to the file referenced by the supplied file descriptor.

external fun write(fd: Number, string: String, callback: (err: ErrnoException?, written: Double, str: String) -> Unit)
external fun write(fd: Number, string: String, position: Double?, callback: (err: ErrnoException?, written: Double, str: String) -> Unit)
external fun write(fd: Number, string: String, position: Double?, encoding: BufferEncoding?, callback: (err: ErrnoException?, written: Double, str: String) -> Unit)

Asynchronously writes string to the file referenced by the supplied file descriptor.

external fun <TBuffer : ArrayBufferView> write(fd: Number, buffer: TBuffer, offset: Double?, length: Double?, position: Double?, callback: (err: ErrnoException?, written: Double, buffer: TBuffer) -> Unit)

Write buffer to the file specified by fd.

Link copied to clipboard
suspend fun writeFile(file: PathLike, data: ArrayBufferView): Void
suspend fun writeFile(file: PathLike, data: AsyncIterable<Any>): Void
suspend fun writeFile(file: PathLike, data: JsIterable<Any>): Void
suspend fun writeFile(file: PathLike, data: Stream): Void
suspend fun writeFile(file: FileHandle, data: ArrayBufferView): Void
suspend fun writeFile(file: FileHandle, data: AsyncIterable<Any>): Void
suspend fun writeFile(file: FileHandle, data: JsIterable<Any>): Void
suspend fun writeFile(file: FileHandle, data: String): Void
suspend fun writeFile(file: FileHandle, data: Stream): Void
suspend fun writeFile(file: PathLike, data: ArrayBufferView, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: PathLike, data: ArrayBufferView, options: WriteFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: PathLike, data: AsyncIterable<Any>, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: PathLike, data: AsyncIterable<Any>, options: WriteFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: PathLike, data: JsIterable<Any>, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: PathLike, data: JsIterable<Any>, options: WriteFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: PathLike, data: String, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: PathLike, data: String, options: WriteFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: PathLike, data: Stream, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: PathLike, data: Stream, options: WriteFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: FileHandle, data: ArrayBufferView, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: FileHandle, data: ArrayBufferView, options: WriteFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: FileHandle, data: AsyncIterable<Any>, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: FileHandle, data: AsyncIterable<Any>, options: WriteFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: FileHandle, data: JsIterable<Any>, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: FileHandle, data: JsIterable<Any>, options: WriteFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: FileHandle, data: String, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: FileHandle, data: String, options: WriteFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: FileHandle, data: Stream, options: BufferEncoding? = undefined.unsafeCast<Nothing>()): Void
suspend fun writeFile(file: FileHandle, data: Stream, options: WriteFileAsyncOptions? = undefined.unsafeCast<Nothing>()): Void

Asynchronously writes data to a file, replacing the file if it already exists. data can be a string, a buffer, an AsyncIterable, or an Iterable object.

suspend fun writeFile(file: PathLike, data: String): Void

external fun writeFile(path: PathOrFileDescriptor, data: ArrayBufferView, callback: NoParamCallback)
external fun writeFile(path: PathOrFileDescriptor, data: String, callback: NoParamCallback)

Asynchronously writes data to a file, replacing the file if it already exists.

external fun writeFile(file: PathOrFileDescriptor, data: ArrayBufferView, options: WriteFileOptions, callback: NoParamCallback)
external fun writeFile(file: PathOrFileDescriptor, data: String, options: WriteFileOptions, callback: NoParamCallback)

When file is a filename, asynchronously writes data to the file, replacing the file if it already exists. data can be a string or a buffer.

Link copied to clipboard
external fun writeFileAsync(file: PathLike, data: ArrayBufferView): Promise<Void>
external fun writeFileAsync(file: PathLike, data: AsyncIterable<Any>): Promise<Void>
external fun writeFileAsync(file: PathLike, data: JsIterable<Any>): Promise<Void>
external fun writeFileAsync(file: PathLike, data: String): Promise<Void>
external fun writeFileAsync(file: PathLike, data: Stream): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: AsyncIterable<Any>): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: JsIterable<Any>): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: String): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: Stream): Promise<Void>
external fun writeFileAsync(file: PathLike, data: ArrayBufferView, options: BufferEncoding? = definedExternally): Promise<Void>
external fun writeFileAsync(file: PathLike, data: ArrayBufferView, options: WriteFileAsyncOptions? = definedExternally): Promise<Void>
external fun writeFileAsync(file: PathLike, data: AsyncIterable<Any>, options: BufferEncoding? = definedExternally): Promise<Void>
external fun writeFileAsync(file: PathLike, data: AsyncIterable<Any>, options: WriteFileAsyncOptions? = definedExternally): Promise<Void>
external fun writeFileAsync(file: PathLike, data: JsIterable<Any>, options: BufferEncoding? = definedExternally): Promise<Void>
external fun writeFileAsync(file: PathLike, data: JsIterable<Any>, options: WriteFileAsyncOptions? = definedExternally): Promise<Void>
external fun writeFileAsync(file: PathLike, data: String, options: BufferEncoding? = definedExternally): Promise<Void>
external fun writeFileAsync(file: PathLike, data: String, options: WriteFileAsyncOptions? = definedExternally): Promise<Void>
external fun writeFileAsync(file: PathLike, data: Stream, options: BufferEncoding? = definedExternally): Promise<Void>
external fun writeFileAsync(file: PathLike, data: Stream, options: WriteFileAsyncOptions? = definedExternally): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: ArrayBufferView, options: BufferEncoding? = definedExternally): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: ArrayBufferView, options: WriteFileAsyncOptions? = definedExternally): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: AsyncIterable<Any>, options: BufferEncoding? = definedExternally): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: AsyncIterable<Any>, options: WriteFileAsyncOptions? = definedExternally): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: JsIterable<Any>, options: BufferEncoding? = definedExternally): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: JsIterable<Any>, options: WriteFileAsyncOptions? = definedExternally): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: String, options: BufferEncoding? = definedExternally): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: String, options: WriteFileAsyncOptions? = definedExternally): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: Stream, options: BufferEncoding? = definedExternally): Promise<Void>
external fun writeFileAsync(file: FileHandle, data: Stream, options: WriteFileAsyncOptions? = definedExternally): Promise<Void>

Asynchronously writes data to a file, replacing the file if it already exists. data can be a string, a buffer, an AsyncIterable, or an Iterable object.

Link copied to clipboard
external fun writeFileSync(file: PathOrFileDescriptor, data: ArrayBufferView, options: WriteFileOptions = definedExternally)
external fun writeFileSync(file: PathOrFileDescriptor, data: String, options: WriteFileOptions = definedExternally)

Returns undefined.

Link copied to clipboard
external fun writeSync(fd: Number, string: String, position: Double? = definedExternally, encoding: BufferEncoding? = definedExternally): Double

Synchronously writes string to the file referenced by the supplied file descriptor, returning the number of bytes written.

external fun writeSync(fd: Number, buffer: ArrayBufferView, offset: Double? = definedExternally, length: Double? = definedExternally, position: Double? = definedExternally): Double

For detailed information, see the documentation of the asynchronous version of this API: {@link write}.

Link copied to clipboard
external fun writev(fd: Number, buffers: ReadonlyArray<ArrayBufferView>, cb: (err: ErrnoException?, bytesWritten: Double, ReadonlyArray<ArrayBufferView>) -> Unit)

Write an array of ArrayBufferViews to the file specified by fd using writev().

external fun writev(fd: Number, buffers: ReadonlyArray<ArrayBufferView>, position: Number, cb: (err: ErrnoException?, bytesWritten: Double, ReadonlyArray<ArrayBufferView>) -> Unit)
Link copied to clipboard
external fun writevSync(fd: Number, buffers: ReadonlyArray<ArrayBufferView>, position: Number = definedExternally): Double

For detailed information, see the documentation of the asynchronous version of this API: {@link writev}.