submit
Version:
form upload and progress api
36 lines (26 loc) • 1.03 kB
Markdown
# submit
form upload and progress api
[](https://travis-ci.org/ForbesLindesay/submit)
[](https://david-dm.org/ForbesLindesay/submit)
[](https://www.npmjs.com/package/submit)
## Installation
npm install submit
## Usage: `submit(form).to(path)`
Submit the form `form` to the path `path`.
The result is a [Promises/A+](http://promises-aplus.github.io/promises-spec/) promise with the addition of a small subset of the event emitter API that only supports `progress` events which can be handled by calling `.on('progress', (e) => ...)`
```js
var submit = require('submit');
submit(form).to('/upload')
.on('progress', function (e) {
console.log(e.percent + '%');
})
.then(function (res) {
console.log('complete')
}, function (err) {
console.log('error')
})
.done();
}
```
## License
MIT