- 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 path
string | Buffer | URL The path to be checked mode
number <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 file
string | Buffer | number Filename or file descriptor data
string | Buffer The data to be written options
AppendFileOptions | 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 path
string | Buffer | URL File or directory path mode
number 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 path
string | Buffer | URL File or directory path uid
number The new owner id gid
number 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 fd
number 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 src
string | Buffer | URL File path to copy dest
string | Buffer | URL Destination to copy to flags
number <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 path
string | Buffer | URL File or directory path options
ReadStreamOptions | 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 path
string | Buffer | URL File or directory path options
WriteStreamOptions | 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 path
string | 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 fd
number The file descriptor id mode
number 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 fd
number The file descriptor id uid
number The new owner id gid
number 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 fd
number 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 fd
number 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 fd
number 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 fd
number The file descriptor id len
number 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 fd
number The file descriptor id atime
number The atime mtime
number 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 path
string | Buffer The file path mode
number 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 path
string | Buffer The file path uid
number The new owner id gid
number 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 existingPath
string | Buffer | URL The existing file path newPath
string | 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 path
string | 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 path
string | Buffer | URL The file path mode
number <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 prefix
string The prefix of the temporary folder to create options
EncodingOptions | 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 path
string | Buffer | URL The file path flags
string | number The flags for opening the file. mode
number <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 fd
number The file descriptor buffer
Buffer | Uint8Array The buffer that he data will be written to. offset
number The offset in the buffer to start writing at length
number The the number of bytes to read position
number 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 path
string | Buffer | URL The file path options
EncodingOptions | 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 path
string | Buffer | URL | integer The file path or file descriptor options
EncodingOptions | 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 path
string | Buffer | URL The file path options
EncodingOptions | 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 path
string | Buffer | URL The file path options
EncodingOptions | 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 oldPath
string | Buffer | URL The old file path newPath
string | 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 path
string | 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 path
string | 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 target
string | Buffer | URL The path to link from path
string | Buffer | URL The path to link to type
string `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 path
string | Buffer The file path len
number 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 path
string | 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 path
string | Buffer The file path listener
function <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 path
string | Buffer | URL The file path atime
number The atime mtime
number The mtime - Source:
- fs.js#L558
Returns:
- Type
- Promise.<void>
-
<static> watch(path [, options], listener)
-
Identical to fs.watch.
Parameters:
Name Type Argument Description path
string | Buffer The file path options
WatchOptions <optional>
The watch options listener
function The listener function - Source:
- fs.js#L576
Returns:
- Type
- FSWatcher
-
<static> watchFile(path [, options], listener)
-
Identical to fs.watchFile.
Parameters:
Name Type Argument Description path
string | Buffer | URL The file path options
WatchOptions <optional>
The watch options listener
function 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 fd
number The file descriptor id buffer
Buffer | Uint8Array The buffer to write to file offset
number <optional>
The offset in the buffer to start reading at length
number <optional>
The the number of bytes to write position
number <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 file
string | Buffer | integer The filename or file descriptor data
string | Buffer | Uint8Array The data to write to file options
WriteOptions <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 encoding
string <optional>
'utf8' The file encoding mode
number <optional>
0o666 The chmod flag
string <optional>
'a' The flag -
EncodingOptions
-
Type:
- Object
- Source:
- fs.js#L417
Properties:
Name Type Argument Default Description encoding
string <optional>
'utf8' The encoding for the temporary directory -
ReadObject
-
Type:
- Object
- Source:
- fs.js#L442
Properties:
Name Type Description bytesRead
number The number of bytes read buffer
Buffer | Uint8Array The buffer containing the data read -
ReadStreamOptions
-
- Source:
- fs.js#L260
Properties:
Name Type Argument Default Description flags
string <optional>
'r' The flags to use defaultEncoding
string <optional>
null The encoding to use fd
number <optional>
null The file descriptor mode
number <optional>
0o666 The chmod to use autoClose
boolean <optional>
true If the stream should auto close start
number <optional>
The starting spot end
number <optional>
The ending spot -
WatchOptions
-
- Source:
- fs.js#L568
Properties:
Name Type Argument Default Description persistent
boolean <optional>
true Indicates whether the process should continue to run as long as files are being watched. recursive
boolean <optional>
false Indicates whether all subdirectories should be watched, or only the current directory. encoding
string <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 encoding
string <optional>
'utf8' The file encoding mode
number <optional>
0o666 The chmod flag
string <optional>
'w' The flag -
WriteStreamOptions
-
- Source:
- fs.js#L281
Properties:
Name Type Argument Default Description flags
string <optional>
'w' The flags to use defaultEncoding
string <optional>
'utf8' The encoding to use fd
number <optional>
null The file descriptor mode
number <optional>
0o666 The chmod to use autoClose
boolean <optional>
true If the stream should auto close start
number <optional>
The starting spot