0.4.3 • Published 6 years ago

sails-hook-uploads v0.4.3

Weekly downloads
691
License
MIT
Repository
github
Last release
6 years ago

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

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.8

7 years ago

0.2.7

7 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago