file-cloud-storage

1.6.0 • Public • Published

File Cloud Storage

Install

$ npm install file-cloud-storage

Functions

  • getContent(bucket, fileName) returns a promise resolved to the file content
  • uploadFile(bucket, fileName, filePath) returns a promise
  • uploadText(bucket, fileName, content) returns a promise

Usage

import getS3Client from 'file-cloud-storage';
 
const bucket = 'files';
const fileName = 'test.txt';
const endpoint = '<endpoint>';
 
(async () => {
    try {
        const { getContent, uploadFile, uploadText } = await getS3Client('ibm', { apiKeyId: '<apiKey>', endpoint });
        await uploadFile(bucket, 'test.mp3', './files/test.mp3');
        await uploadText(bucket, fileName, 'test content');
        const fileContent = await getContent(bucket, fileName);
        console.log(fileContent);
    } catch (e) {
        console.error(e);
    }    
})();

Readme

Keywords

Package Sidebar

Install

npm i file-cloud-storage

Weekly Downloads

0

Version

1.6.0

License

MIT

Unpacked Size

45.9 kB

Total Files

23

Last publish

Collaborators

  • elgin