Supplemental: Asynchronously append data to a file, creating the file if it not yet exists.
Supplemental: Synchronously append data to a file, creating the file if it not yet exists.
Optional: Asynchronous chmod
or lchmod
.
True
if lchmod
, false if chmod
. Has no
bearing on result if links aren't supported.
Optional: Synchronous chmod
or lchmod
.
True
if lchmod
, false if chmod
. Has no
bearing on result if links aren't supported.
Optional: Asynchronous chown
or lchown
.
True
if lchown
, false if chown
. Has no
bearing on result if links aren't supported.
Optional: Synchronous chown
or lchown
.
True
if lchown
, false if chown
. Has no
bearing on result if links aren't supported.
Optional: Passes the following information to the callback:
Supplemental: Test whether or not the given path exists by checking with the file system. Then call the callback argument with either true or false.
Supplemental: Test whether or not the given path exists by checking with the file system.
Optional: Returns the name of the file system.
Core: Is this filesystem read-only?
True if this FileSystem is inherently read-only.
Optional: Asynchronous link
.
Optional: Synchronous link
.
Core: Asynchronous mkdir
.
Mode to make the directory using. Can be ignored if the filesystem doesn't support permissions.
Core: Synchronous mkdir
.
Mode to make the directory using. Can be ignored if the filesystem doesn't support permissions.
Core: Asynchronous file open.
Mode to use to open the file. Can be ignored if the filesystem doesn't support permissions.
Supplemental: Asynchronously reads the entire contents of a file.
If non-null, the file's contents should be decoded into a string using that encoding. Otherwise, if encoding is null, fetch the file's contents as a Buffer.
If no encoding is specified, then the raw buffer is returned.
Supplemental: Synchronously reads the entire contents of a file.
If non-null, the file's contents should be decoded into a string using that encoding. Otherwise, if encoding is null, fetch the file's contents as a Buffer.
Core: 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 '..'
.
Core: Synchronous readdir
. Reads the contents of a directory.
Optional: Asynchronous readlink.
Optional: Synchronous readlink.
Supplemental: Asynchronous realpath
. The callback gets two arguments
(err, resolvedPath)
.
Note that the Node API will resolve path
to an absolute path.
An object literal of mapped paths that can be used to
force a specific path resolution or avoid additional fs.stat
calls for
known real paths. If not supplied by the user, it'll be an empty object.
Supplemental: Synchronous realpath
.
Note that the Node API will resolve path
to an absolute path.
An object literal of mapped paths that can be used to
force a specific path resolution or avoid additional fs.stat
calls for
known real paths. If not supplied by the user, it'll be an empty object.
Core: Asynchronous rename. No arguments other than a possible exception are given to the completion callback.
Core: Synchronous rename.
Core: Asynchronous rmdir
.
Core: Synchronous rmdir
.
Core: Asynchronous stat
or lstat
.
True if this is lstat
, false if this is regular
stat
.
Core: Synchronous stat
or lstat
.
True if this is lstat
, false if this is regular
stat
.
Core: Does the filesystem support optional symlink/hardlink-related commands?
True if the FileSystem supports the optional symlink/hardlink-related commands.
Core: Does the filesystem support optional property-related commands?
True if the FileSystem supports the optional property-related commands (permissions, utimes, etc).
Core: Does the filesystem support the optional synchronous interface?
True if the FileSystem supports synchronous operations.
Optional: Asynchronous symlink
.
can be either 'dir'
or 'file'
Optional: Synchronous symlink
.
can be either 'dir'
or 'file'
Supplemental: Asynchronous truncate
.
Supplemental: Synchronous truncate
.
Core: Asynchronous unlink
.
Core: Synchronous unlink
.
Optional: Change file timestamps of the file referenced by the supplied path.
Optional: Change file timestamps of the file referenced by the supplied path.
Supplemental: Asynchronously writes data to a file, replacing the file if it already exists.
The encoding option is ignored if data is a buffer.
Supplemental: Synchronously writes data to a file, replacing the file if it already exists.
The encoding option is ignored if data is a buffer.
Generated using TypeDoc
Interface for a filesystem. All BrowserFS FileSystems should implement this interface.
Below, we denote each API method as Core, Supplemental, or Optional.
Core Methods
Core API methods need to be implemented for basic read/write functionality.
Note that read-only FileSystems can choose to not implement core methods that mutate files or metadata. The default implementation will pass a NOT_SUPPORTED error to the callback.
Supplemental Methods
Supplemental API methods do not need to be implemented by a filesystem. The default implementation implements all of the supplemental API methods in terms of the core API methods.
Note that a file system may choose to implement supplemental methods for efficiency reasons.
The code for some supplemental methods was adapted directly from NodeJS's fs.js source code.
Optional Methods
Optional API methods provide functionality that may not be available in all filesystems. For example, all symlink/hardlink-related API methods fall under this category.
The default implementation will pass a NOT_SUPPORTED error to the callback.
Argument Assumptions
You can assume the following about arguments passed to each API method:
.
,..
, and other items are resolved into an absolute form.setImmediate
to reset the JavaScript stack depth before calling the user-supplied callback.