wispfnDocs
Function SDK

File storage — write, read, readText, stat, delete and list.

import { file } from 'wisp';   // async
from wisp import file          # synchronous

Guide: Files.

#file.write(path, data, options?)

data is a string (stored as UTF-8) or bytes (JS: Buffer, Uint8Array or ArrayBuffer). The content type is guessed from the extension unless you pass one. Replaces an existing file. Returns { path, size, contentType, updatedAt }.

await file.write('exports/orders.csv', csv, { contentType: 'text/csv' });
file.write("exports/orders.csv", csv, content_type="text/csv")

#file.read(path)

The contents as bytes (JS Buffer, Python bytes), or null / None.

#file.readText(path)

Python: file.read_text(path). The contents as a string, or null / None.

#file.stat(path)

{ path, size, contentType, updatedAt } without downloading, or null / None.

#file.delete(path)

Deletes the file.

#file.list(options?)

OptionDefaultDescription
prefix""Only paths starting with this
limit100Maximum items
cursornullFrom the previous page

Returns { items: [{ path, size, updatedAt }], cursor }.

#Limits

Paths: no leading /, no .., up to 1,024 bytes. Files up to 25 MB. Responses are limited to about 6 MB.