wispfnDocs
Store data

Store uploads, images, PDFs and generated reports up to 25 MB, and serve them from your functions.

import { file } from 'wisp';

await file.write('reports/2026-11.csv', csvText);           // content type from the extension
const info = await file.stat('reports/2026-11.csv');         // { path, size, contentType, updatedAt }
const bytes = await file.read('uploads/42/photo.jpg');       // Buffer, or null
from wisp import file

file.write("reports/2026-11.csv", csv_text)
info = file.stat("reports/2026-11.csv")
data = file.read("uploads/42/photo.jpg")  # bytes, or None

#Methods

MethodReturns
write(path, data, { contentType }){ path, size, contentType, updatedAt }. Replaces an existing file.
read(path)Bytes, or null / None
readText(path) (Python read_text)A string, or null / None
stat(path)Metadata without downloading, or null / None
delete(path)—
list({ prefix, limit, cursor }){ items: [{ path, size, updatedAt }], cursor }

Full signatures: file reference.

#Paths

Use folder-like paths such as uploads/<id>/photo.jpg: no leading slash, no .., up to 1,024 bytes. The console groups files by their top-level folder.

#Serve a file

export async function handler(req) {
  const id = req.subpath.slice(1);
  const meta = await file.stat(`images/${id}.png`);
  if (!meta) return { status: 404, body: { error: 'Not found' } };
  return { status: 200, headers: { 'content-type': meta.contentType }, body: await file.read(meta.path) };
}

Responses are limited to about 6 MB. Combine with edge caching for files that don't change often.

#Accept an upload

Send the file as the raw request body:

curl -X POST "https://my-api.fn.wispfn.com/upload?name=photo.jpg" \
  -H "content-type: image/jpeg" --data-binary @photo.jpg
export async function handler(req) {
  const data = req.isBase64Encoded ? Buffer.from(req.rawBody, 'base64') : Buffer.from(req.rawBody);
  const saved = await file.write(`uploads/${crypto.randomUUID()}/${req.query.name}`, data);
  return { status: 201, body: saved };
}

#Limits

  • Files up to 25 MB.
  • Request bodies up to 6 MB — split bigger uploads or upload them elsewhere.
  • Keep an index in key-value or a table when you need to find files by something other than their path.