# fs
A Node.js-compatible implementation of the core fs module
NOTE
This is an abstract type. Any object of this structure can be used where this type is used.
# Overview
Titanium provides a number of shims and ports of core Node.js module functionality.
This module is intended to provide a Node-compatible port of the fs core module.
More details on the Node.js API can be found in their fs module documentation (opens new window)
The fs module enables interacting with the file system in a way modeled on standard POSIX functions.
To use this module:
const fs = require('fs');
All file system operations have synchronous and asynchronouse callback forms.
NOTE: The Titanium shim for this module does not support the new Promises API yet, nor does it support some of the newer (and a subset of older) APIs.
Some of the APIs are implemented as no-ops:
chmodchmodSyncchownchownSyncfchmodfchmodSyncfchownfchownSyncfdatasyncfdatasyncSyncsymlinksymlinkSyncunwatchFileutimesutimesSyncwatchwatchFile
Explicitly unsupported for now are:
fs.createReadStreamfs.createWriteStreamfs.fsync(fd, callback)fs.fsyncSync(fd)fs.ftruncate(fd[, len], callback)fs.ftruncateSync(fd[, len])fs.futimes(fd, atime, mtime, callback)fs.futimesSync(fd, atime, mtime)fs.lchmod(path, mode, callback)fs.lchmodSync(path, mode)fs.lchown(path, uid, gid, callback)fs.lchownSync(path, uid, gid)fs.link(existingPath, newPath, callback)fs.linkSync(existingPath, newPath)fs.opendirfs.opendirSyncfs.readlink(path[, options], callback)fs.readlinkSync(path[, options])fs.rmfs.rmSync
# Properties
# constants
Returns an object containing commonly used constants for file system operations. The specific constants currently defined are described in fs.constants.
# Methods
# access
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.
Check File access constants for possible values of mode.
It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. fs.constants.W_OK | fs.constants.R_OK).
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | filepath |
mode | Number | mode/permissions to check |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# accessSync
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.
Check File access constants for possible values of mode.
It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. fs.constants.W_OK | fs.constants.R_OK).
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | filepath |
mode | Number | mode/permissions to check |
Returns
- Type
- void
# appendFile
Asynchronously append data to a file, creating the file if it does not yet exist. data can be a string or a buffer.Buffer.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | Number | filepath or file descriptor |
data | String | buffer.Buffer | data to append |
options | fs.appendFile.options | String | options |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# appendFileSync
Synchronously append data to a file, creating the file if it does not yet exist. data can be a string or a buffer.Buffer.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | Number | filepath or file descriptor |
data | String | buffer.Buffer | data to append |
options | fs.appendFile.options | String | options |
Returns
- Type
- void
# chmod
Asynchronously changes the permissions of a file. No arguments other than a possible exception are given to the completion callback.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | filepath |
mode | String | Number | new mode/permissions |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# chmodSync
Synchronously changes the permissions of a file.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | filepath |
mode | String | Number | new mode/permissions |
Returns
- Type
- void
# chown
Asynchronously changes owner and group of a file. No arguments other than a possible exception are given to the completion callback.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | filepath |
uid | Number | new owner |
gid | Number | new group |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# chownSync
Synchronously changes owner and group of a file.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | filepath |
uid | Number | new owner |
gid | Number | new group |
Returns
- Type
- void
# close
Asynchronous close. No arguments other than a possible exception are given to the completion callback.
Calling fs.close() on any file descriptor (fd) that is currently in use through any other fs operation may lead to undefined behavior.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# closeSync
Synchronous close.
Calling fs.close() on any file descriptor (fd) that is currently in use through any other fs operation may lead to undefined behavior.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
Returns
- Type
- void
# copyFile
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.
mode is an optional integer that specifies the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE).
fs.constants.COPYFILE_EXCL: The copy operation will fail if dest already exists.fs.constants.COPYFILE_FICLONE: The copy operation will attempt to create a copy-on-write reflink. If the platform does not support copy-on-write, then a fallback copy mechanism is used.fs.constants.COPYFILE_FICLONE_FORCE: The copy operation will attempt to create a copy-on-write reflink. If the platform does not support copy-on-write, then the operation will fail.
Parameters
| Name | Type | Description |
|---|---|---|
src | String | source filename to copy |
dest | String | destination filename of the copy operation |
mode | Number | modifiers for copy operation. |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# copyFileSync
Synchronously copies src to dest. By default, dest is overwritten if it already exists. 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.
mode is an optional integer that specifies the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE).
fs.constants.COPYFILE_EXCL: The copy operation will fail if dest already exists.fs.constants.COPYFILE_FICLONE: The copy operation will attempt to create a copy-on-write reflink. If the platform does not support copy-on-write, then a fallback copy mechanism is used.fs.constants.COPYFILE_FICLONE_FORCE: The copy operation will attempt to create a copy-on-write reflink. If the platform does not support copy-on-write, then the operation will fail.
Parameters
| Name | Type | Description |
|---|---|---|
src | String | source filename to copy |
dest | String | destination filename of the copy operation |
mode | Number | modifiers for copy operation. |
Returns
- Type
- void
# exists
Test whether or not the given path exists by checking with the file system.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
callback | Function<Boolean> | atypical async callback function that received the result as a single boolean arguments |
Returns
- Type
- void
# existsSync(path)
Test whether or not the given path exists by checking with the file system.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
Returns
- Type
- Boolean
# fchmod
Asynchronous fchmod.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
mode | String | Number | new mode/permissions |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# fchmodSync
Synchronous fchmod.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
mode | String | Number | new mode/permissions |
Returns
- Type
- void
# fchown
Asynchronous fchown.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
uid | Number | new owner |
gid | Number | new group |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# fchownSync
Synchronous fchown.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
uid | Number | new owner |
gid | Number | new group |
Returns
- Type
- void
# fdatasync
Asynchronous fdatasync.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# fdatasyncSync
Synchronous fdatasync.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
Returns
- Type
- void
# fstat
Asynchronous fstat.
The callback gets two arguments (err, stats) where stats is an fs.Stats object.
fstat() is identical to stat(), except that the file to be stat-ed is specified by the file descriptor fd.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
options | fs.stat.options | options |
callback | Function<Error, fs.Stats> | typical async callback function |
Returns
- Type
- void
# fstatSync
Synchronous fstat.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
options | fs.stat.options | options |
Returns
- Type
- fs.Stats
# lstat
Asynchronous lstat.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | fs.stat.options | options |
callback | Function<Error, fs.Stats> | typical async callback function |
Returns
- Type
- void
# lstatSync
Synchronous lstat.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | fs.stat.options | options |
Returns
- Type
- fs.Stats
# mkdir
Asynchronously creates a directory.
The callback is given a possible exception and, if recursive is true, the first directory path created, (err, [path]).
The optional options argument can be an integer specifying mode (permission and sticky bits), or an object with a mode property and a recursive property indicating whether parent directories should be created.
Calling fs.mkdir() when path is a directory that exists results in an error only when recursive is false.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | fs.mkdir.options | options |
callback | Function<Error, String> | typical async callback function. The second argument is an optional path |
Returns
- Type
- void
# mkdirSync
Synchronously creates a directory.
Returns undefined, or if recursive istrue, the first directory path created. This is the synchronous version offs.mkdir()`.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | fs.mkdir.options | options |
Returns
will return undefined if recursive option is not true
- Type
- String
# mkdtemp
Creates a unique temporary directory.
Generates six random characters to be appended behind a required prefix to create a unique temporary directory. 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.
The created directory path is passed as a string to the callback's second parameter.
The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use.
Parameters
| Name | Type | Description |
|---|---|---|
prefix | String | file prefix |
options | String | fs.mkdtemp.options | encoding if |
callback | Function<Error, String> | typical async callback function. The second argument is the generated path |
Returns
- Type
- void
# mkdtempSync
For detailed information, see the documentation of the asynchronous version of this API: mkdtemp.
The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use.
Parameters
| Name | Type | Description |
|---|---|---|
prefix | String | file prefix |
options | String | fs.mkdtemp.options | encoding if |
Returns
Returns the created directory path.
- Type
- String
# open
Asynchronous file open. See open(2).
mode sets the file mode (permission and sticky bits), but only if the file was created. On Windows, only the write permission can be manipulated; see fs.chmod().
The callback gets two arguments (err, fd).
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
flags | String | Number | file system flags |
mode | Number | String | file permissions |
callback | Function<Error, Number> | typical async callback function, the second argument is an integer representing a file descriptor |
Returns
- Type
- void
# openSync
For detailed information, see the documentation of the asynchronous version of this API: fs.open().
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
flags | String | Number | file system flags |
mode | Number | String | file permissions |
Returns
Returns an integer representing the file descriptor.
- Type
- Number
# read
Read data from the file specified by fd.
buffer is the buffer that the data (read from the fd) will be written to.
offset is the offset in the buffer to start writing at.
length is an integer specifying the number of bytes to read.
position is an argument specifying where to begin reading from in the file. If position is null, data will be read from the current file position, and the file position will be updated. If position is an integer, the file position will remain unchanged.
The callback is given the three arguments, (err, bytesRead, buffer).
If the file is not modified concurrently, the end-of-file is reached when the number of bytes read is zero.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
buffer | buffer.Buffer | Titanium.Buffer | buffer to read |
offset | Number | the offset in the buffer to start writing at. |
length | Number | integer specifying the number of bytes to read. |
position | Number | where to begin reading from in the file. Unused/unsupported in Titanium. |
callback | Function<Error, Number, buffer.Buffer> | async callback function |
Returns
- Type
- void
# readdir
Asynchronous readdir. 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 '..'.
The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use for the filenames passed to the callback. If the encoding is set to 'buffer', the filenames returned will be passed as Buffer objects.
If options.withFileTypes is set to true, the files array will contain fs.Dirent objects. NOTE: Titanium does not yet support this.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | fs.readdir.options | options |
callback | Function<Error, Array<String>> | Typical async callback function. The second argument is an array of results which may be |
Returns
- Type
- void
# readdirSync
Synchronous readdir.
The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use for the filenames returned. If the encoding is set to 'buffer', the filenames returned will be passed as Buffer objects.
If options.withFileTypes is set to true, the result will contain fs.Dirent objects. Note: Titanium does not yet support this.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | fs.readdir.options | options |
Returns
an array of results which may be Strings, buffer.Buffers, or fs.Dirents
- Type
- Array<String> | Array<buffer.Buffer> | Array<fs.Dirent>
# readFile
Asynchronously reads the entire contents of a file.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | fs.readFile.options | String | encoding |
callback | Function<Error, String> | typical async callback function, the second argument is either a |
Returns
- Type
- void
# readFileSync
Synchronously reads the entire contents of a file.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | fs.readFile.options | String | encoding |
Returns
either a string or a buffer.Buffer, based upon options.encoding
- Type
- String | buffer.Buffer
# readSync
For detailed information, see the documentation of the asynchronous version of this API: fs.read().
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
buffer | buffer.Buffer | Titanium.Buffer | buffer to read |
offset | Number | the offset in the buffer to start writing at. |
length | Number | integer specifying the number of bytes to read. |
position | Number | where to begin reading from in the file. Unused/unsupported in Titanium. |
Returns
Returns the number of bytesRead.
- Type
- Number
# realpath
Asynchronously computes the canonical pathname by resolving ., .. and symbolic links.
A canonical pathname is not necessarily unique. Hard links and bind mounts can expose a file system entity through many pathnames.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | Object | options |
callback | Function<Error, String> | typical async callback function |
Returns
- Type
- void
# realpath.native
Asynchronous realpath.
The callback gets two arguments (err, resolvedPath).
Only paths that can be converted to UTF8 strings are supported.
The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use for the path passed to the callback. If the encoding is set to 'buffer', the path returned will be passed as a Buffer object.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | Object | options |
callback | Function<Error, String> | typical async callback function |
Returns
- Type
- void
# realpathSync
Returns the resolved pathname.
For detailed information, see the documentation of the asynchronous version of this API: fs.realpath().
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | Object | options |
Returns
- Type
- String
# realpathSync.native
Synchronous realpath.
Only paths that can be converted to UTF8 strings are supported.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | Object | options |
Returns
- Type
- String
# rename
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.
Parameters
| Name | Type | Description |
|---|---|---|
oldPath | String | buffer.Buffer | source file path |
newPath | String | buffer.Buffer | destination file path |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# renameSync
Synchronous rename. Returns undefined.
Parameters
| Name | Type | Description |
|---|---|---|
oldPath | String | buffer.Buffer | source file path |
newPath | String | buffer.Buffer | destination file path |
Returns
- Type
- void
# rmdir
Asynchronous rmdir
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | fs.rmDir.options | options |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# rmSync
Synchronously removes files and directories (modeled on the standard POSIX rm utility). Returns undefined.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | fs.rm.options | options |
Returns
- Type
- void
# stat
Asynchronous stat. The callback gets two arguments (err, stats) where stats is an fs.Stats object.
In case of an error, the err.code will be one of Common System Errors.
Using fs.stat() to check for the existence of a file before calling fs.open(), fs.readFile() or fs.writeFile() is not recommended. Instead, user code should open/read/write the file directly and handle the error raised if the file is not available.
To check if a file exists without manipulating it afterwards, fs.access() is recommended.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | Object | fs.stat.options |
callback | Function<Error, fs.Stats> | typical async callback function |
Returns
- Type
- void
# statSync
Synchronous stat.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
options | fs.stat.options | options |
Returns
- Type
- fs.Stats
# symlink
Asynchronous symlink which creates the link called path pointing to target. No arguments other than a possible exception are given to the completion callback.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
target | String | buffer.Buffer | target of the new symlink |
path | String | buffer.Buffer | the symlink path |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# symlinkSync
Synchronous symlink which creates the link called path pointing to target. No arguments other than a possible exception are given to the completion callback.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
target | String | buffer.Buffer | target of the new symlink |
path | String | buffer.Buffer | the symlink path |
Returns
- Type
- void
# truncate
Asynchronous truncate. Returns undefined.
A file descriptor can also be passed as the first argument. In this case, fs.ftruncateSync() is called.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
len | Number | target length to truncate to |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# truncateSync
Synchronous truncate. Returns undefined.
A file descriptor can also be passed as the first argument. In this case, fs.ftruncateSync() is called.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
len | Number | target length to truncate to |
Returns
- Type
- void
# unlink
Asynchronous unlink. Returns undefined.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# unlinkSync
Synchronous unlink. Returns undefined.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
Returns
- Type
- void
# unwatchFile
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.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
filename | String | buffer.Buffer | file path |
listener | Function | callback function when file changes |
Returns
- Type
- void
# utimes
Change the file system timestamps of the object referenced by path.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
atime | Number | String | Date | access time |
mtime | Number | String | Date | modification time |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# utimesSync
Change the file system timestamps of the object referenced by path.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
path | String | buffer.Buffer | file path |
atime | Number | String | Date | access time |
mtime | Number | String | Date | modification time |
Returns
- Type
- void
# watch
Watch for changes on filename, where filename is either a file or a directory.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
filename | String | buffer.Buffer | file path |
options | Object | options |
listener | Function | callback function when file changes |
Returns
- Type
- void
# watchFile
Watch for changes on filename. The callback listener will be called each time the file is accessed.
This is a no-op on Titanium.
Parameters
| Name | Type | Description |
|---|---|---|
filename | String | buffer.Buffer | file path |
options | Object | options |
listener | Function | callback function when file changes |
Returns
- Type
- void
# write
For detailed information, see the documentation of the asynchronous version of this API.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
buffer | String | buffer.Buffer | buffer contents to write |
offset | Number | from the beginning of the file where this data should be written |
length | String | Number | length in bytes of |
position | Number | offset from the beginning of the file where this data should be written (if data to be written is a |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# writeFile
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.
When file is a file descriptor, the behavior is similar to calling fs.write() directly (which is recommended). See the notes below on using a file descriptor.
The encoding option is ignored if data is a buffer. If data is a normal object, it must have an own toString function property.
Parameters
| Name | Type | Description |
|---|---|---|
file | String | buffer.Buffer | Number | filename or file descriptor |
data | String | buffer.Buffer | Object | data to write |
options | fs.writeFile.options | from the beginning of the file where this data should be written |
callback | Function<Error> | typical async callback function |
Returns
- Type
- void
# writeFileSync
For detailed information, see the documentation of the asynchronous version of this API: fs.writeFile().
Parameters
| Name | Type | Description |
|---|---|---|
file | String | buffer.Buffer | Number | filename or file descriptor |
data | String | buffer.Buffer | Object | data to write |
options | fs.writeFile.options | from the beginning of the file where this data should be written |
Returns
- Type
- void
# writeSync
For detailed information, see the documentation of the asynchronous version of this API.
Parameters
| Name | Type | Description |
|---|---|---|
fd | Number | file descriptor |
buffer | String | buffer.Buffer | buffer contents to write |
offset | Number | from the beginning of the file where this data should be written |
length | String | Number | length in bytes of |
position | Number | offset from the beginning of the file where this data should be written (if data to be written is a |
Returns
bytes written
- Type
- Number