Skip to content

Storage

Storage keeps the bytes of every File, addressed by content hash, while the File record lives in the database.

Storage keeps the bytes of every File, addressed by content hash, while the File's record lives in db.sb like any other Thing.

Contract

  • A File record holds the hash, size, media type, owner and visibility. Bytes never change: a new version is a new File, linked to the one it replaces.
  • Visibility is Owner by default, or Customer, or Public. Every read checks it against the caller's Permissions.
  • Large uploads go straight to storage through a signed URL.
  • A share link is signed and expires, after 7 days by default.
  • Deleting a File marks it. Masking and Suppression are the privacy controls, so history and legal holds stay intact.
  • Stored and served bytes count into a Meter.
  • Agents pass Files by reference and never hold raw bytes in a model's context when a reference serves.

Verbs

VerbObjectEvent
File.createFileFile.created
File.getFileNone.

Interfaces

Example

TypeScript
import { readFile } from 'node:fs/promises'
import { $ } from 'startup-builder'

// A contract-review service stores a signed agreement its client may read.
const pdf = await readFile('msa-signed.pdf')
const file = await $.File.create({ name: 'msa-signed.pdf', contentType: 'application/pdf', size: pdf.byteLength, visibility: 'Customer' })