Skip to content

vobi-ge/cloud-upploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js Cloud storage file uploader

Painless file uploader to cloud storages for Node.js

Install

npm i -S cloud-uploader

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('cloud-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)

Upload file base64

const remotePath = `remote/path/filename`
const imageData = 'data:image/gif;base64,R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7.....'
const result = await Uploader.upload(null, remotePath, { base64: imageData })

Get file url

const url = Uploader.getUrl(remotePath)

Delete file

await Uploader.deleteFile(remotePath)

About

S3 & Google file uploader

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •