Storage SDK & CLI
Official @nfyio/storage npm package — a typed SDK and CLI for nfyio Object Storage, plus the plain AWS SDK / aws-cli path.
Storage SDK & CLI — @nfyio/storage
@nfyio/storage is the official npm package for nfyio Object Storage: a typed
TypeScript SDK and a nfyio-storage CLI. nfyio is S3-compatible, so the package
is a small nfyio-branded wrapper over the AWS S3 client — and any off-the-shelf
S3 tool works too.
Get your Access Key / Secret Key from the dashboard: Object Storage → your bucket → Keys, or Settings → Access Tokens.
Install
npm install @nfyio/storage
SDK
import { NfyioStorage } from '@nfyio/storage'
const storage = new NfyioStorage({
accessKeyId: process.env.NFYIO_ACCESS_KEY!,
secretAccessKey: process.env.NFYIO_SECRET_KEY!,
// endpoint: 'https://<wsslug>.fsn1.storage.nfyio.com' // dedicated workspaces only
})
// Upload / download / delete
await storage.put('my-bucket', 'reports/q1.pdf', bytes, { contentType: 'application/pdf' })
const data = await storage.get('my-bucket', 'reports/q1.pdf')
await storage.delete('my-bucket', 'reports/q1.pdf')
// List under a prefix
const { objects } = await storage.list('my-bucket', { prefix: 'reports/' })
// Presigned URLs — share without exposing credentials
const getUrl = await storage.presignGet('my-bucket', 'reports/q1.pdf', { expiresIn: 3600 })
const putUrl = await storage.presignPut('my-bucket', 'uploads/new.bin', { expiresIn: 900 })
Methods
| Method | Description |
|---|---|
put(bucket, key, body, opts?) | Upload an object (contentType, acl, metadata). |
get(bucket, key) | Download an object as Uint8Array. |
delete(bucket, key) | Delete an object. |
exists(bucket, key) | true if the object exists. |
list(bucket, opts?) | List objects (prefix, maxKeys, continuationToken). |
presignGet(bucket, key, opts?) | Presigned download URL. |
presignPut(bucket, key, opts?) | Presigned upload URL. |
s3 | The underlying AWS S3 client for advanced operations. |
CLI
export NFYIO_ACCESS_KEY=... NFYIO_SECRET_KEY=...
nfyio-storage ls my-bucket reports/
nfyio-storage cp ./q1.pdf nfyio://my-bucket/reports/q1.pdf # upload
nfyio-storage cp nfyio://my-bucket/reports/q1.pdf ./q1.pdf # download
nfyio-storage rm my-bucket reports/q1.pdf
nfyio-storage presign my-bucket reports/q1.pdf 3600
Plain AWS SDK / aws-cli
Because the endpoint is S3-compatible, the standard tools work directly:
aws --endpoint-url https://s3.nfyio.com s3 ls s3://my-bucket/
aws --endpoint-url https://s3.nfyio.com s3 cp ./q1.pdf s3://my-bucket/reports/q1.pdf
import { S3Client } from '@aws-sdk/client-s3'
const s3 = new S3Client({
endpoint: 'https://s3.nfyio.com',
region: 'fsn1',
credentials: { accessKeyId: '...', secretAccessKey: '...' },
})
Quotas are enforced: if an upload would push you past your plan’s storage limit and no card is on file, the request is rejected with
402. Add a payment method to allow overage (billed per your plan).