squareboat / nest-storage

A multi-disk multi-driver filesystem manager for NestJS. 💾
https://squareboat.com/open-source/nestjs-boilerplate/storage
MIT License
101 stars 17 forks source link

Adding support driver for Aliyun oss #10

Closed pbalan closed 2 years ago

pbalan commented 2 years ago

Hi @vinayak25 ,

Firstly, thanks for creating a great module. This is really helpful for switching the storage on the fly.

I'd like to contribute to your project. Please kindly help review the code and help publish this through npm.

Thanks!

pbalan commented 2 years ago

One callout here. get method returns the object instead of buffer.

Am using it as below.

import { Storage } from '@squareboat/nest-storage';

..
..
..
const storage = Storage.disk('images');
    const fp = join(
      __dirname,
      '..',
      '..',
      'src',
      'shared',
      'images',
      'Hotel-2.jpeg',
    );
    const image = await storage.get('test.jpeg');
    const res = image as unknown as any;
    const resp = await fs.writeFile(await fp, res.res?.data);
    (await fp).close();