Methods
(async) mkdir(path)
Make a directory in the filesystem.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
String | the path to the directory. |
Throws:
-
if the directory cannot be created.
- Type
- Error
(async) mountIdbfs(path)
Mount a directory as the IDBFS filesystem (persistent storage).
Parameters:
| Name | Type | Description |
|---|---|---|
path |
String | the path to the directory. |
Throws:
-
if the directory cannot be mounted.
- Type
- Error
(async) readDir(path) → {Array}
Get the files in a directory.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
String | the path to the directory. |
Throws:
-
if the files cannot be retrieved.
- Type
- Error
Returns:
the files in the directory.
- Type
- Array
(async) readFile(path) → {Buffer}
Read a file from the filesystem.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
String | the path to the file. |
Throws:
-
if the file cannot be read.
- Type
- Error
Returns:
the file contents.
- Type
- Buffer
(async) rename(oldPath, newPath)
Rename a file in the filesystem.
Parameters:
| Name | Type | Description |
|---|---|---|
oldPath |
String | the old path to the file. |
newPath |
String | the new path to the file. |
Throws:
-
if the file cannot be renamed.
- Type
- Error
(async) rmdir(path)
Remove a directory from the filesystem.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
String | the path to the directory. |
Throws:
-
if the directory cannot be removed.
- Type
- Error
(async) stat(path) → {Object}
Get the status of a file in the filesystem.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
String | the path to the file. |
Throws:
-
if the status cannot be retrieved.
- Type
- Error
Returns:
the status of the file.
- Type
- Object
(async) syncfs(populate)
Synchronize the IDBFS filesystem with the underlying storage.
Parameters:
| Name | Type | Description |
|---|---|---|
populate |
Boolean | control the intended direction of the synchronization `true` to initialize the file system data with the data from the file system’s persistent source, and `false` to save the file system data to the file system’s persistent source. |
Throws:
-
if the filesystem cannot be synchronized.
- Type
- Error
(async) unlink(path)
Remove a file from the filesystem.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
String | the path to the file. |
Throws:
-
if the file cannot be removed.
- Type
- Error
(async) unmount(path)
Unmount a mounted filesystem.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
String | the path to the filesystem. |
Throws:
-
if the filesystem cannot be unmounted.
- Type
- Error
(async) writeFile(path, data)
Write a file to the filesystem.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
String | the path to the file. |
data |
Buffer | String | the data to write. |
Throws:
-
if the file cannot be written.
- Type
- Error