0.4.3 • Published 5 years ago
sails-hook-uploads v0.4.3
sails-hook-uploads
Adds an easier interface for working with file uploads and downloads in your Node.js/Sails app. Supports async/await.
Only supports Node 8 and up.
npm install sails-hook-uploads
Usage
var uploaded = await sails.uploadOne(inputs.someFile);
Available methods:
- .uploadOne(upstreamOrReadable) (accepts any Readable stream, or an incoming Sails file upload of 0 or 1 file; returns either
undefined
or a dictionary w/ information about the uploaded file data.) - .upload(upstream) (accepts any incoming Sails file upload -- whether it consists of 0, 1, or ≥2 files; returns an array regardless.)
- .reservoir(upstreamOrReadable) (accepts any Readable stream, or any incoming Sails file upload -- whether it consists of 0, 1, or ≥2 files; returns an array regardless.)
- .startDownload(fd) (useful for downloading a file; returns a Readable)
- .cp(srcFd, srcOpts, destOpts) (useful for transloading an already-uploaded file to a different destination)
- .rm(fd)
- .ls()
All methods use configuration from sails.config.uploads
. Most inherited settings can be overridden (see source code for details- it's pretty simple in there).
For more usage tips, see the Ration.io example app and tutorial course.
License
MIT
© 2017-present Rachael Shaw, Mike McNeil
0.4.3
5 years ago
0.4.2
5 years ago
0.4.1
5 years ago
0.4.0
5 years ago
0.3.1
6 years ago
0.3.0
6 years ago
0.2.8
6 years ago
0.2.7
6 years ago
0.2.6
6 years ago
0.2.5
6 years ago
0.2.4
6 years ago
0.2.3
6 years ago
0.2.2
6 years ago
0.2.1
6 years ago
0.2.0
6 years ago
0.1.1
6 years ago
0.1.0
6 years ago
0.0.3
6 years ago
0.0.2
6 years ago
0.0.1
6 years ago