https://github.com/ducktors/storagebus
A storage abstraction layer for Node.js that removes any difference among multiple public cloud storage services and local filesystems
https://github.com/ducktors/storagebus
gcs gcs-bucket s3 s3-bucket storage
Last synced: about 1 year ago
JSON representation
A storage abstraction layer for Node.js that removes any difference among multiple public cloud storage services and local filesystems
- Host: GitHub
- URL: https://github.com/ducktors/storagebus
- Owner: ducktors
- License: mit
- Created: 2022-10-14T08:33:13.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-06-30T08:04:22.000Z (about 1 year ago)
- Last Synced: 2025-06-30T09:22:49.150Z (about 1 year ago)
- Topics: gcs, gcs-bucket, s3, s3-bucket, storage
- Language: TypeScript
- Homepage:
- Size: 1.16 MB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
---
---

[](https://github.com/ducktors/storagebus/actions/workflows/ci.yml) [](https://github.com/ducktors/storagebus/actions/workflows/test.yml) [](https://coveralls.io/github/ducktors/storagebus?branch=main) [](https://codeclimate.com/github/ducktors/storagebus/maintainability) [](https://www.npmjs.com/package/@ducktors/storagebus) [](https://www.npmjs.com/package/@ducktors/storagebus-abstract) [](https://www.npmjs.com/package/@ducktors/storagebus-local)
[](https://www.npmjs.com/package/@ducktors/storagebus-gcs)
[](https://www.npmjs.com/package/@ducktors/storagebus-s3)
[](https://www.npmjs.com/package/@ducktors/storagebus-memory)
[](#contributors-)
Storagebus is a storage abstraction layer for Node.js that removes any difference among multiple public cloud storage services and local filesystems.
## Usage
You can use Storagebus with your filesystem, AWS and GCP:
```javascript
const { Storage } = require("storage/local");
// const { Storage } = require('storage/aws')
// const { Storage } = require('storage/gcp')
const { Readable } = require("node:stream");
const storage = new Storage({
rootFolder: "path/to/folder",
});
// const storage = new Storage({
// bucket: 'your-aws-bucket';
// region: 'your-aws-region';
// accessKeyId: 'your-aws-access-key';
// secretAccessKey: 'your-aws-secret-access-key';
// })
// const storage = new Storage({
// bucket: 'your-gcp-bucket';
// projectId: 'your-gcp-project-id';
// clientEmail: 'your-gcp-client-email';
// privateKey: 'your-gcp-private-key';
// })
async function main() {
// Your readable stream
const readable = Readable.from("Hello, world!");
// write a file
const writtenFileString = await storage.write("your-file.txt", readable);
// read a file from your storage
const fileReadable = await storage.read("your-file.txt");
// check for file existance in your storage
const exist = await storage.exists("your-file.txt");
// copy file
const copiedFileString = await storage.copy(
"your-file.txt",
"your-file-copy.txt"
);
// move a file
const movedFileString = await storage.move(
"your-file-copy.txt",
"moved/your-file-copy.txt"
);
// delete a file
await storage.remove("your-file.txt");
}
```
## Contribute to this project
1. Clone this repository
`git clone git@github.com:github.com/ducktors/storagebus.git`
2. Move inside repository folder
`cd storagebus`
3. Install dependencies
`pnpm install`
4. Run the project in development mode
`pnpm dev`
## How to release
The release is performed by the maintainers of the repository. New versions are managed via [changesets](https://github.com/changesets/changesets).
To release a new version, simply choose which package to bump with `pnpm release` command:
```
$ pnpm release
> @ducktors/storagebus@0.9.0 release /ducktors-workstation/storagebus
> changeset
🦋 Which packages would you like to include? …
◯ unchanged packages
◯ @ducktors/storagebus-abstract
◯ @ducktors/storagebus-gcs
◯ @ducktors/storagebus-local
◯ @ducktors/storagebus-s3
```
## Contributors