- Source:
- fs.js#L21
Properties:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
constants |
Object | Identical to fs.constants.
Properties
|
Methods
-
<static> access(path [, mode])
-
Identical to fs.access but returns a promise instead.
Parameters:
Name Type Argument Description pathstring | Buffer | URL The path to be checked modenumber <optional>
The accessibility checks to be performed - Source:
- fs.js#L206
Returns:
- Type
- Promise.<void>
-
<static> appendFile(file, data [, options])
-
Identical to fs.appendFile but returns a promise instead.
Parameters:
Name Type Argument Description filestring | Buffer | number Filename or file descriptor datastring | Buffer The data to be written optionsAppendFileOptions | string <optional>
Options for the append, or the encoding. - Source:
- fs.js#L223
Returns:
- Type
- Promise.<void>
-
<static> chmod(path, mode)
-
Identical to fs.chmod but returns a promise instead.
Parameters:
Name Type Description pathstring | Buffer | URL File or directory path modenumber The chmod to be applied - Source:
- fs.js#L233
Returns:
- Type
- Promise.<void>
-
<static> chown(path, uid, gid)
-
Identical to fs.chown but returns a promise instead.
Parameters:
Name Type Description pathstring | Buffer | URL File or directory path uidnumber The new owner id gidnumber The new group id - Source:
- fs.js#L242
Returns:
- Type
- Promise.<void>
-
<static> close(fd)
-
Identical to fs.close but returns a promise instead.
Parameters:
Name Type Description fdnumber The file descriptor - Source:
- fs.js#L252
Returns:
- Type
- Promise.<void>
-
<static> copyFile(src, dest [, flags])
-
Identical to fs.copyFile but returns a promise instead.
Parameters:
Name Type Argument Default Description srcstring | Buffer | URL File path to copy deststring | Buffer | URL Destination to copy to flagsnumber <optional>
0 modifiers for copy operation. - Source:
- fs.js#L65
Returns:
- Type
- Promise.<void>
-
<static> createReadStream(path [, options])
-
Identical to fs.createReadStream.
Parameters:
Name Type Argument Description pathstring | Buffer | URL File or directory path optionsReadStreamOptions | string <optional>
The stream options or the encoding - Source:
- fs.js#L272
Returns:
- Type
- ReadStream
-
<static> createWriteStream(path [, options])
-
Identical to fs.createWriteStream.
Parameters:
Name Type Argument Description pathstring | Buffer | URL File or directory path optionsWriteStreamOptions | string <optional>
The stream options or the encoding - Source:
- fs.js#L292
Returns:
- Type
- WriteStream
-
<static> exists(path)
-
Identical to fs.exists but returns a promise instead.
Parameters:
Name Type Description pathstring | Buffer | URL The file or directory path - Deprecated:
-
- Use Stat or pathExists instead.
- Source:
- fs.js#L301
Returns:
- Type
- Promise.<boolean>
-
<static> fchmod(fd, mode)
-
Identical to fs.fchmod but returns a promise instead.
Parameters:
Name Type Description fdnumber The file descriptor id modenumber The chmod to be applied - Source:
- fs.js#L310
Returns:
- Type
- Promise.<void>
-
<static> fchown(fd, uid, gid)
-
Identical to fs.fchown but returns a promise instead.
Parameters:
Name Type Description fdnumber The file descriptor id uidnumber The new owner id gidnumber The new group id - Source:
- fs.js#L319
Returns:
- Type
- Promise.<void>
-
<static> fdatasync(fd)
-
Identical to fs.fdatasync but returns a promise instead.
Parameters:
Name Type Description fdnumber The file descriptor id - Source:
- fs.js#L329
Returns:
- Type
- Promise.<void>
-
<static> fstat(fd)
-
Identical to fs.fstat but returns a promise instead.
Parameters:
Name Type Description fdnumber The file descriptor id - Source:
- fs.js#L337
Returns:
- Type
- Promise.<Stats>
-
<static> fsync(fd)
-
Identical to fs.fsync but returns a promise instead.
Parameters:
Name Type Description fdnumber The file descriptor id - Source:
- fs.js#L345
Returns:
- Type
- Promise.<void>
-
<static> ftruncate(fd, len)
-
Identical to fs.ftruncate but returns a promise instead.
Parameters:
Name Type Description fdnumber The file descriptor id lennumber The length in bytes to truncate to - Source:
- fs.js#L353
Returns:
- Type
- Promise.<void>
-
<static> futimes(fd, atime, mtime)
-
Identical to fs.futimes but returns a promise instead.
Parameters:
Name Type Description fdnumber The file descriptor id atimenumber The atime mtimenumber The mtime - Source:
- fs.js#L362
Returns:
- Type
- Promise.<void>
-
<static> lchmod(path, mode)
-
Identical to fs.lchmod but returns a promise instead.
Parameters:
Name Type Description pathstring | Buffer The file path modenumber The chmod - Source:
- fs.js#L372
Returns:
- Type
- Promise.<void>
-
<static> lchown(path, uid, gid)
-
Identical to fs.lchown but returns a promise instead.
Parameters:
Name Type Description pathstring | Buffer The file path uidnumber The new owner id gidnumber The new group id - Source:
- fs.js#L381
Returns:
- Type
- Promise.<void>
-
<static> link(existingPath, newPath)
-
Identical to fs.link but returns a promise instead.
Parameters:
Name Type Description existingPathstring | Buffer | URL The existing file path newPathstring | Buffer | URL The new file path - Source:
- fs.js#L391
Returns:
- Type
- Promise.<void>
-
<static> lstat(path)
-
Identical to fs.lstat but returns a promise instead.
Parameters:
Name Type Description pathstring | Buffer | URL The file path - Source:
- fs.js#L400
Returns:
- Type
- Promise.<Stats>
-
<static> mkdir(path [, mode])
-
Identical to fs.mkdir but returns a promise instead.
Parameters:
Name Type Argument Default Description pathstring | Buffer | URL The file path modenumber <optional>
0o777 The chmod - Source:
- fs.js#L408
Returns:
- Type
- Promise.<void>
-
<static> mkdtemp(prefix [, options])
-
Identical to fs.mkdtemp but returns a promise instead.
Parameters:
Name Type Argument Default Description prefixstring The prefix of the temporary folder to create optionsEncodingOptions | string <optional>
'utf8' The temporary directory options, or encoding - Source:
- fs.js#L423
Returns:
The folder path- Type
- Promise.<string>
-
<static> open(path, flags [, mode])
-
Identical to fs.open but returns a promise instead.
Parameters:
Name Type Argument Default Description pathstring | Buffer | URL The file path flagsstring | number The flags for opening the file. modenumber <optional>
0o666 The chmod - Source:
- fs.js#L432
Returns:
The file descriptor- Type
- Promise.<integer>
-
<static> read(fd, buffer, offset, length, position)
-
Identical to fs.read but returns a promise instead.
Parameters:
Name Type Description fdnumber The file descriptor bufferBuffer | Uint8Array The buffer that he data will be written to. offsetnumber The offset in the buffer to start writing at lengthnumber The the number of bytes to read positionnumber The the postilion to begin reading from the file - Source:
- fs.js#L449
Returns:
- Type
- Promise.<ReadObject>
-
<static> readdir(path [, options])
-
Identical to fs.readdir but returns a promise instead.
Parameters:
Name Type Argument Default Description pathstring | Buffer | URL The file path optionsEncodingOptions | string <optional>
'utf8' The encoding options - Source:
- fs.js#L461
Returns:
The files and directories- Type
- Promise.<(Array.<string>|Buffer)>
-
<static> readFile(path [, options])
-
Identical to fs.readFile but returns a promise instead.
Parameters:
Name Type Argument Default Description pathstring | Buffer | URL | integer The file path or file descriptor optionsEncodingOptions | string <optional>
{encoding: null, flag: 'r'} The encoding options - Source:
- fs.js#L470
Returns:
The file contents- Type
- Promise.<(string|Buffer)>
-
<static> readlink(path [, options])
-
Identical to fs.readlink but returns a promise instead.
Parameters:
Name Type Argument Default Description pathstring | Buffer | URL The file path optionsEncodingOptions | string <optional>
'utf8' The encoding options - Source:
- fs.js#L479
Returns:
The linkString- Type
- Promise.<(string|Buffer)>
-
<static> realpath(path [, options])
-
Identical to fs.realpath but returns a promise instead.
Parameters:
Name Type Argument Default Description pathstring | Buffer | URL The file path optionsEncodingOptions | string <optional>
'utf8' The encoding options - Source:
- fs.js#L488
Returns:
The resolvedPath- Type
- Promise.<(string|Buffer)>
-
<static> rename(oldPath, newPath)
-
Identical to fs.rename but returns a promise instead.
Parameters:
Name Type Description oldPathstring | Buffer | URL The old file path newPathstring | Buffer | URL The new file path - Source:
- fs.js#L497
Returns:
- Type
- Promise.<void>
-
<static> rmdir(path)
-
Identical to fs.rmdir but returns a promise instead.
Parameters:
Name Type Description pathstring | Buffer | URL The directory path - Source:
- fs.js#L506
Returns:
- Type
- Promise.<void>
-
<static> stat(path)
-
Identical to fs.stat but returns a promise instead.
Parameters:
Name Type Description pathstring | Buffer | URL The file path - Source:
- fs.js#L514
Returns:
- Type
- Promise.<Stats>
-
<static> symlink(target, path, type)
-
Identical to fs.symlink but returns a promise instead.
Parameters:
Name Type Description targetstring | Buffer | URL The path to link from pathstring | Buffer | URL The path to link to typestring `dir`, `file`, or `junction` windows only - Source:
- fs.js#L522
Returns:
- Type
- Promise.<void>
-
<static> truncate(path, len)
-
Identical to fs.truncate but returns a promise instead.
Parameters:
Name Type Description pathstring | Buffer The file path lennumber The number of bytes to truncate to - Source:
- fs.js#L532
Returns:
- Type
- Promise.<void>
-
<static> unlink(path)
-
Identical to fs.unlink but returns a promise instead.
Parameters:
Name Type Description pathstring | Buffer | URL The file path - Source:
- fs.js#L541
Returns:
- Type
- Promise.<void>
-
<static> unwatchFile(path [, listener])
-
Identical to fs.unwatchFile.
Parameters:
Name Type Argument Description pathstring | Buffer The file path listenerfunction <optional>
The listener function - Source:
- fs.js#L549
Returns:
- Type
- Promise.<void>
-
<static> utimes(path, atime, mtime)
-
Identical to fs.utimes but returns a promise instead.
Parameters:
Name Type Description pathstring | Buffer | URL The file path atimenumber The atime mtimenumber The mtime - Source:
- fs.js#L558
Returns:
- Type
- Promise.<void>
-
<static> watch(path [, options], listener)
-
Identical to fs.watch.
Parameters:
Name Type Argument Description pathstring | Buffer The file path optionsWatchOptions <optional>
The watch options listenerfunction The listener function - Source:
- fs.js#L576
Returns:
- Type
- FSWatcher
-
<static> watchFile(path [, options], listener)
-
Identical to fs.watchFile.
Parameters:
Name Type Argument Description pathstring | Buffer | URL The file path optionsWatchOptions <optional>
The watch options listenerfunction The listener function - Source:
- fs.js#L586
Returns:
- Type
- FSWatcher
-
<static> write(fd, buffer [, offset] [, length] [, position])
-
Identical to fs.write but returns a promise instead.
Parameters:
Name Type Argument Description fdnumber The file descriptor id bufferBuffer | Uint8Array The buffer to write to file offsetnumber <optional>
The offset in the buffer to start reading at lengthnumber <optional>
The the number of bytes to write positionnumber <optional>
The the position to begin writing to the file - Source:
- fs.js#L596
Returns:
- Type
- Promise.<void>
-
<static> writeFile(file, data [, options])
-
Identical to fs.writeFile but returns a promise instead.
Parameters:
Name Type Argument Description filestring | Buffer | integer The filename or file descriptor datastring | Buffer | Uint8Array The data to write to file optionsWriteOptions <optional>
The write options - Source:
- fs.js#L616
Returns:
- Type
- Promise.<void>
Type Definitions
-
AppendFileOptions
-
- Source:
- fs.js#L215
Properties:
Name Type Argument Default Description encodingstring <optional>
'utf8' The file encoding modenumber <optional>
0o666 The chmod flagstring <optional>
'a' The flag -
EncodingOptions
-
Type:
- Object
- Source:
- fs.js#L417
Properties:
Name Type Argument Default Description encodingstring <optional>
'utf8' The encoding for the temporary directory -
ReadObject
-
Type:
- Object
- Source:
- fs.js#L442
Properties:
Name Type Description bytesReadnumber The number of bytes read bufferBuffer | Uint8Array The buffer containing the data read -
ReadStreamOptions
-
- Source:
- fs.js#L260
Properties:
Name Type Argument Default Description flagsstring <optional>
'r' The flags to use defaultEncodingstring <optional>
null The encoding to use fdnumber <optional>
null The file descriptor modenumber <optional>
0o666 The chmod to use autoCloseboolean <optional>
true If the stream should auto close startnumber <optional>
The starting spot endnumber <optional>
The ending spot -
WatchOptions
-
- Source:
- fs.js#L568
Properties:
Name Type Argument Default Description persistentboolean <optional>
true Indicates whether the process should continue to run as long as files are being watched. recursiveboolean <optional>
false Indicates whether all subdirectories should be watched, or only the current directory. encodingstring <optional>
'utf8' Specifies the character encoding to be used for the filename passed to the listener. -
WriteOptions
-
- Source:
- fs.js#L608
Properties:
Name Type Argument Default Description encodingstring <optional>
'utf8' The file encoding modenumber <optional>
0o666 The chmod flagstring <optional>
'w' The flag -
WriteStreamOptions
-
- Source:
- fs.js#L281
Properties:
Name Type Argument Default Description flagsstring <optional>
'w' The flags to use defaultEncodingstring <optional>
'utf8' The encoding to use fdnumber <optional>
null The file descriptor modenumber <optional>
0o666 The chmod to use autoCloseboolean <optional>
true If the stream should auto close startnumber <optional>
The starting spot