StorageBus is a storage abstraction layer for Node.js that removes differences among public cloud storage services, local filesystems, and in-memory storage.
StorageBus v1 has two core operations:
write(objectKey, data)writes, replaces, or deletes an object.file(objectKey)returns aBusFile, which can stream content and expose metadata.
You can use StorageBus with your filesystem, AWS S3, Google Cloud Storage, or memory:
import { Readable } from 'node:stream'
import { Storage } from '@storagebus/storage'
import { createAdapter } from '@storagebus/local'
const storage = new Storage(createAdapter({ root: '/path/to/folder' }))
async function main() {
const objectKey = await storage.write('hello.txt', 'Hello, world!')
const file = await storage.file(objectKey)
console.log(file.name)
console.log(file.type)
console.log(file.size)
console.log(await file.text())
await storage.write('stream.txt', () => Readable.from('stream content'))
// Passing null deletes the Object Key.
await storage.write('hello.txt', null)
}@storagebus/storage: coreStorage,BusFile, Adapter contract, shared errors, and compliance tests.@storagebus/memory: in-memory Adapter.@storagebus/local: local filesystem Adapter.@storagebus/s3: AWS S3 Adapter.@storagebus/gcs: Google Cloud Storage Adapter.
StorageBus v1 creates Storage from the core package and injects an Adapter from the target Storage Backend package.
Before v1:
import { createStorage } from '@storagebus/local'
const storage = createStorage({ root: '/path/to/folder' })In v1:
import { Storage } from '@storagebus/storage'
import { createAdapter } from '@storagebus/local'
const storage = new Storage(createAdapter({ root: '/path/to/folder' }))Storage options such as debug, logger, and sanitizeKey now belong to Storage, not Adapter packages:
const storage = new Storage(createAdapter({ root: '/path/to/folder' }), {
sanitizeKey: true,
})-
Clone this repository
git clone git@github.com:github.com/ducktors/storagebus.git -
Move inside repository folder
cd storagebus -
Install dependencies
pnpm install -
Run the project in development mode
pnpm dev
The release is performed by the maintainers of the repository. New versions are managed via changesets.
To release a new version, simply choose which package to bump with pnpm release command:
$ pnpm release
> storagebus@0.9.0 release /ducktors-workstation/storagebus
> changeset
🦋 Which packages would you like to include? …
◯ unchanged packages
◯ @storagebus/storage
◯ @storagebus/gcs
◯ @storagebus/local
◯ @storagebus/s3
Maksim Sinik 💻 |
Matteo Vivona 🚇 🛡️ 📖 |
Andrew Hu 📖 |
Alessandro Di Dio 💻 |

