1.7.4 • Published 1 month ago
@cloud-cli/storage v1.7.4
File storage service
A file bin service for all your quick and easy storage needs.
API
See api.yaml
for API specification.
Usage
With docker
docker pull ghcr.io/cloud-cli/storage:latest
docker run --rm -e ROOT_DIR=/opt/data -e PORT=1234 -v$PWD/data:/opt/data ghcr.io/cloud-cli/storage:latest
See also the release page.
As a standalone server with Node.JS
import start from '@cloud-cli/storage';
start({ rootDir: process.cwd() + '/data', port: 1234 });
As an ES Module
Consuming it as an ES module: if the server is running at https://bin.example.com
, import it as a module in a project:
import { createBin, createFile, writeFile, readFile } from 'https://bin.example.com/index.mjs';
async function save(content) {
const { binId } = await createBin();
const { fileId } = await createFile(binId);
return await writeFile(binId, fileId, content);
}
const { binId, fileID, url } = await save('hello');
const content = await readFile(binId, fileId);
// or directly
const hello = await (await fetch(url)).text();
Environment variables
env | description |
---|---|
ROOT_DIR | String. Path to a folder where all data is stored |
PORT | Number. HTTP port |
1.7.3
1 month ago
1.7.2
1 month ago
1.7.1
1 month ago
1.7.0
1 month ago
1.7.4
1 month ago
1.6.1
2 months ago
1.6.0
2 months ago
1.5.2
3 months ago
1.5.1
4 months ago
1.5.0
4 months ago
1.4.0
4 months ago
1.2.0
4 months ago
1.1.0
4 months ago
1.3.1
4 months ago
1.3.0
4 months ago
1.0.9
5 months ago
1.0.8
5 months ago
1.0.7
5 months ago
1.0.6
5 months ago
1.0.5
5 months ago
1.0.4
5 months ago
1.0.3
5 months ago
1.0.2
5 months ago
1.0.1
5 months ago
1.0.0
5 months ago