@trubavuong/fastify-seaweedfs

1.0.2 • Public • Published

fastify-seaweedfs

SeaweedFS for Fastify

Install

$ npm install @trubavuong/fastify-seaweedfs

Usage

const fastify = require('fastify');
const plugin = require('@trubavuong/fastify-seaweedfs');

const app = fastify();
app.register(plugin, {
  endpoint: 'http://localhost:9333', // required, SeaweedFS endpoint
  name: 'swfs',                      // optional, custom property name, default 'fs'
  type: 'BLOCK_STORAGE',             // optional, storage type, default 'BLOCK_STORAGE', currently we have only one type
});

// later you can use app.swfs to interact with SeaweedFS server using corresponding storage APIs

app.get('/files/:fid', async (req, res) => {
  const stream = await app.swfs.get(req.params.fid);
  res.send(stream);
});

To interact with SeaweedFS, we use @trubavuong/seaweedfs package. Please read its documentation in order to work with app.swfs.

Package Sidebar

Install

npm i @trubavuong/fastify-seaweedfs

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

6.25 kB

Total Files

5

Last publish

Collaborators

  • trubavuong