| import { mkdir, rm } from "node:fs/promises"; | |
| export const FolderWorkspacePlugin = async ({ experimental_workspace }) => { | |
| experimental_workspace.register("folder", { | |
| name: "Folder", | |
| description: "Create a blank folder", | |
| configure(config) { | |
| const rand = "" + Math.random(); | |
| return { | |
| ...config, | |
| directory: `/tmp/folder/folder-${rand}`, | |
| }; | |
| }, | |
| async create(config) { | |
| if (!config.directory) | |
| return; | |
| await mkdir(config.directory, { recursive: true }); | |
| }, | |
| async remove(config) { | |
| await rm(config.directory, { recursive: true, force: true }); | |
| }, | |
| target(config) { | |
| return { | |
| type: "local", | |
| directory: config.directory, | |
| }; | |
| }, | |
| }); | |
| return {}; | |
| }; | |
| export default FolderWorkspacePlugin; | |
Xet Storage Details
- Size:
- 938 Bytes
- Xet hash:
- a34fe6f8307b4cf226783167b4a9d21d6f4b5be055213e86ad9fe2029df6d4ea
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.