LensStudio:FileSystem
ModuleBefore using anything in this namespace, make sure to import LensStudio:FileSystem and add filesystem in your plugin's module.json.
Example
// module.json
{
"main": "main.js",
"permissions": ["filesystem"]
}
// main.js
import * as fs from 'LensStudio:FileSystem';
let s = fs.readFile(new Editor.Path(import.meta.resolve('ellipsis.txt')));
Classes
| Class | Description |
|---|---|
| CopyDirOptions | Used with "LensStudio:FileSystem".CopyDirOptions. |
| CreateDirOptions | Used with "LensStudio:FileSystem".CreateDirOptions. |
| ReadDirOptions | Used with "LensStudio:FileSystem".ReadDirOptions. |
| TempDir | Helper to create temporary directory. |
| Watcher | Watches a file or directory for changes and emits events when modifications occur. |
Functions
| Function | Description |
|---|---|
| copyDir | Options can take recursive and force. The recursive parameter controls whether to read into subdirectories. The force parameter controls whether duplicated contents will be overwritten during the copying process. |
| copyFile | Copies a file from src to dest. |
| createDir | Create a directory at path. |
| exists | Checks if a file or directory exists at path. |
| isDirectory | Checks whether a path is a directory. |
| isFile | Checks whether a path is a file. |
| readBytes | Returns the content of path as bytes. |
| readDir | Returns an array of paths relative to the specified one. |
| readFile | Returns the content of path. |
| realPath | Resolves a path to its canonical absolute form, following symlinks. |
| remove | Removes the path. |
| rename | Renames the path. |
| size | Get the size of path. |
| writeFile | Writes a file to path given the data. |