Usage
Methods
fs.readFile
Reads the file specified at path and returns an object containing the contents, or an object containing an error if there was one. Required permissions: read.
fs.writeFile
Writes the file specified at path with the contents content. Required permissions: read, write-exec.
fs.readDir
Reads the directory specified at path and returns an object containing the contents, or an object containing an error if there was one. Required permissions: read.
fs.createDir
Creates a directory at the specified path. Required permissions: read, write-exec.
fs.deleteFile
Deletes the file at the specified path. Required permissions: read, write-exec.
fs.deleteDir
Deletes the directory at the specified path. Required permissions: read, write-exec.
fs.move
Moves the file or directory at from to to. Required permissions: read, write-exec.
fs.copyFile
Copies the file at from to to. Required permissions: read, write-exec.
fs.watchFile
Watches the file at path for changes with the provided listeners. Returns a dispose method which cleans up the listeners. Required permissions: read.
fs.watchDir
Watches file events (move, create, delete) in the specified directory at the given path. Returns a dispose method which cleans up the listeners. Required permissions: read.
fs.watchTextFile
Watches a text file at path for changes with the provided listeners. Returns a dispose method which cleans up the listeners.
Use this for watching text files, and receive changes as versioned operational transform (OT) operations annotated with their source.
Required permissions: read.
Types
ChangeEventType
A file change event type| Property | Type |
|---|
DeleteEvent
Fired when a file is deleted| Property | Type |
|---|---|
| eventType | Delete |
| node | FsNode |
DirectoryChildNode
A directory child node - a file or a folder.| Property | Type |
|---|---|
| filename | string |
| type | FsNodeType |
FsNode
A base interface for nodes, just includes the type of the node and the path, This interface does not expose the node’s content/children| Property | Type |
|---|---|
| path | string |
| type | FsNodeType |
FsNodeType
A Filesystem node type| Property | Type |
|---|
MoveEvent
Fired when a file is moved| Property | Type |
|---|---|
| eventType | Move |
| node | FsNode |
| to | string |
TextChange
A written text change for the WriteChange function exposed by WatchTextFileListeners.onReady| Property | Type |
|---|---|
| from | number |
| insert? | string |
| to? | number |
TextFileOnChangeEvent
Signifies a change when a text file’s text content is updated| Property | Type |
|---|---|
| changes | TextChange[] |
| latestContent | string |
TextFileReadyEvent
A set of listeners and values exposed by WatchTextFileListeners.onReady| Property | Type |
|---|---|
| getLatestContent | GetLatestContent |
| initialContent | string |
| writeChange | WriteChange |
WatchDirListeners
A set of listeners for watching a directory| Property | Type |
|---|---|
| onChange | WatchDirOnChangeListener |
| onError | WatchDirOnErrorListener |
| onMoveOrDelete? | WatchDirOnMoveOrDeleteListener |
WatchFileListeners
A set of listeners for watching a non-text file<T extends string | Blob = string>
| Property | Type |
|---|---|
| onChange | WatchFileOnChangeListener<T> |
| onError? | WatchFileOnErrorListener |
| onMoveOrDelete? | WatchFileOnMoveOrDeleteListener |
WatchTextFileListeners
A set of listeners for watching a text file| Property | Type |
|---|---|
| onChange? | WatchTextFileOnChangeListener |
| onError? | WatchTextFileOnErrorListener |
| onMoveOrDelete? | WatchTextFileOnMoveOrDeleteListener |
| onReady | WatchTextFileOnReadyListener |