npm.io
0.0.5 • Published 7 years ago

pronto-documents-service

Licence
—
Version
0.0.5
Deps
4
Size
11 kB
Vulns
4
Weekly
0

Documents Service

Interface for uploading files from a url or a local file path.

Configuration

Configure the service with a provider and the configuration for that provider's node api. For now just use s3.

provider: 's3'
s3: {
    accessKeyId: ''
    secretAccessKey: ''
    region: ''
}

If you wanted, you could spin up two separate documents services (with different slugs) that host images on separate providers... and use them to host bulk public & secure images from your platform in different places according to any requirements. You can also just do this with different s3 buckets from different apps.

Methods

uploadFileFromURL = (bucket, url, dest_filename, cb) ->

Upload to a bucket from a url. The file will be saved at s3:[bucket]/dest/filename/here.png

uploadFileFromPath = (bucket, path, dest_filename, cb) ->

Upload to a bucket from a local path on your server. The file will be saved at s3:[bucket]/dest/filename/here.png

deleteDocument = (bucket, full_filename, cb) ->

Remove a file from a bucket with an s3 path from that bucket.