@nwire/storage-fs
v0.7.1
Published
Nwire — local filesystem storage adapter. Implements the Storage contract against a base directory. Suitable for development, single-node deployments, and tests.
Readme
@nwire/storage-fs
Local filesystem adapter for
@nwire/storage— dev / single-node only.
What it does
Implements the Storage contract by writing files under a base directory. Keys map to relative paths under baseDir; paths that would escape baseDir are rejected (no .. traversal). url() returns a file:// URL — not presigned. For client-side fetches, proxy /files/:key through an HTTP wire to fsStorage.getStream(key).
Install
pnpm add @nwire/storage-fs @nwire/storageQuick start
import { fsStorage } from "@nwire/storage-fs";
import { storagePlugin } from "@nwire/storage";
import { defineApp } from "@nwire/forge";
defineApp("my-app", {
plugins: [
storagePlugin({
storage: fsStorage({ baseDir: "./var/uploads" }),
}),
],
});API surface
fsStorage({ baseDir })— implementsStorage.
When to use
Local development without infra, single-node deployments where local disk is fine, tests that want real I/O. Don't use on multi-node deployments — no shared storage.
Within nwire-app
For developers using this package as part of the Nwire stack — register it via app.use(...) or it auto-wires when you compose createApp({ modules }).
import { createApp } from "@nwire/forge";
const app = createApp({
/* ...config... */
});
// Adapter/plugin wiring happens here when applicable.