Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/upload
file upload and progress api
https://github.com/component/upload
Last synced: 12 days ago
JSON representation
file upload and progress api
- Host: GitHub
- URL: https://github.com/component/upload
- Owner: component
- Created: 2012-09-12T20:36:35.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-03-12T21:41:25.000Z (almost 10 years ago)
- Last Synced: 2024-04-14T23:11:33.684Z (9 months ago)
- Language: JavaScript
- Size: 183 KB
- Stars: 39
- Watchers: 14
- Forks: 15
- Open Issues: 3
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# upload
file upload and progress api
## Installation
$ component install component/upload
## Events
- `error` an error occurred
- `abort` upload was aborted
- `progress` (e) upload in progress (`e.percent`, `e.totalSize` etc)
- `end` upload is complete## API
### Upload(file)
Initialize an `Upload` with the given `file`, where `file`
is a `File` object, for example from a `input.files[0]` `FileList`.```js
var upload = new Upload(file);
var upload = Upload(file);
```### Upload#to(path, [fn])
__POST__ the multipart upload to `path` and invoke `fn(err, res)`.
```js
upload.to('/upload');
upload.on('progress', reportProgress);
upload.on('end', done);
```## Running tests
Run the Express test server:
```
$ npm install
$ make test
```# License
MIT