Skip to content

Work with files

Each disk has a virtual root /. Paths in shell commands and JavaScript refer to that disk. Disk names contain 1-128 ASCII letters, digits, underscores or hyphens.

Create the disk and obtain a project API key using the quickstart.

Upload a local file
curl --fail-with-body -X PUT \
"https://api.wabe.sh/v1/disks/demo/files/report.txt" \
-H "Authorization: Bearer YOUR_PROJECT_API_KEY" \
--data-binary @./report.txt
Download a file
curl --fail-with-body \
"https://api.wabe.sh/v1/disks/demo/files/report.txt" \
-H "Authorization: Bearer YOUR_PROJECT_API_KEY" \
--output ./downloaded-report.txt

Bodies are binary streams. PUT replaces the complete file. Readers already holding the previous version can finish reading it. An interrupted upload before publication leaves the existing file unchanged.

Create parent directories before uploading a nested path. Send a shell command through exec:

Create directories
curl --fail-with-body --no-buffer \
"https://api.wabe.sh/v1/disks/demo/exec?kind=bash" \
-H "Authorization: Bearer YOUR_PROJECT_API_KEY" \
--data-binary 'mkdir -p /notes/team'

Inside a JavaScript invocation, use await fs.mkdir('/notes/team', {recursive:true}).

List direct children
curl --fail-with-body --get "https://api.wabe.sh/v1/disks/demo/entries" \
-H "Authorization: Bearer YOUR_PROJECT_API_KEY" \
--data-urlencode 'path=/notes'

The response is NDJSON with one entry per child. For a recursive file listing, execute find /notes -type f or rg --files /notes.

Execute rm /notes/obsolete.txt through the shell, or call await fs.rm('/notes/obsolete.txt') in JavaScript. Removal accepts files and empty directories. Removing a nonempty directory returns an error.

Paths resolve from /; the shell has no mutable working directory. Relative paths such as notes/a.txt resolve to /notes/a.txt. Path normalization collapses . and repeated separators and resolves .. within the disk. Traversal above / is rejected.

A path may contain at most 4,096 UTF-8 bytes, with at most 255 bytes per component. NUL bytes are rejected. Files have virtual type and size metadata; symlinks, executable permissions, native ownership and timestamps are not exposed.

See the file endpoints, directory listing and filesystem JS API.