1.1.0 • Published 5 years ago
cloud-upploader v1.1.0
Node.js Cloud storage file uploader
Painless file uploader to cloud storages for Node.js
Install
npm i -S https://github.com/vobi-io/cloud-upploader
Config
make sure initilize upload
you can use s3
or google
cloud storage and make sure you pass configs for selected provder
place these pease of code in your index.js
or whatever is your main .js file
const Uploader = require('uploader')
Uploader.init({ drive: 'amazon', config: {} })
config for Amazon S3
accessKeyId: 'XXXXXXXXXXXXXXXX',
secretAccessKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
region: 'eu-west-3', // choose best for you
version: 'v4',
bucket: 'bucket-name'
Usage
Upload file
const remotePath = `remote/path/filename`
const localPath = `usr/local/filename`
const result = await Uploader.upload(localPath, remotePath)
Get file url
const url = Uploader.getUrl(remotePath)
Delete file
await Uploader.deleteFile(remotePath)
1.1.0
5 years ago