appcore-files
This is a file handling abstraction for Appcore, allowing easy upload of large data to any persistent location. This library works both in the browser and Node.js.
Last updated 5 years ago by mrgalaxy .
Repository · Original npm · Tarball · package.json
$ cnpm install appcore-files 
SYNC missed versions from official npm registry.

Appcore Files

This is a file handling abstraction for Appcore, allowing easy upload of large data to any persistent location. This library works both in the browser and Node.js.

Usage

Use this package as a plugin on any application:

app.use(require("@beneaththeink/appcore-files"));

This will attach the file object to the app.

Upload

app.files.upload( data, meta [, cb ] ) -> Promise

Upload a file. Returns a promise that is fulfilled when the upload completes.

  • data - A Buffer, Blob, String, ArrayBuffer, or Readable Stream of raw file data.
  • meta - An object providing additional details about the file. This object is directly passed to the adaptor
    • filename (required) - The original name of the file. This can be a full path or just the base name.
    • size - The byte length of the file. This is only required when using a format that doesn't inherently provide the size.
    • mimetype - The mime type of the file. While not required, it is generally recommended to include.
    • adaptor - A registered upload adaptor name or an adaptor method. This is what actually performs the upload.

Upload Adaptors

app.files.upload.register( name, fn )

Registers an upload adaptor.

  • name - The unique id of the adaptor. This can be used in the meta.adaptor property on upload.
  • fn - The adaptor method. This method has a signature of (data, meta, done), where done is callback to be called when complete.

Current Tags

  • 1.3.0                                ...           latest (5 years ago)

1 Versions

  • 1.3.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (11)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |