package.json 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {
  2. "name": "request-progress",
  3. "version": "0.3.0",
  4. "description": "Tracks the download progress of a request made with mikeal/request",
  5. "main": "index.js",
  6. "dependencies": {
  7. "throttleit": "~0.0.2"
  8. },
  9. "devDependencies": {
  10. "mocha": "~1.12.0",
  11. "expect.js": "~0.2.0"
  12. },
  13. "scripts": {
  14. "test": "mocha -R spec"
  15. },
  16. "repository": {
  17. "type": "git",
  18. "url": "git://github.com/IndigoUnited/node-request-progress"
  19. },
  20. "bugs": {
  21. "url": "http://github.com/IndigoUnited/node-request-progress/issues"
  22. },
  23. "keywords": [
  24. "progress",
  25. "request",
  26. "mikeal",
  27. "size",
  28. "bytes",
  29. "percent",
  30. "percentage"
  31. ],
  32. "author": {
  33. "name": "IndigoUnited",
  34. "email": "hello@indigounited.com",
  35. "url": "http://indigounited.com"
  36. },
  37. "license": "MIT",
  38. "readme": "# request-progress [![Build Status](https://secure.travis-ci.org/IndigoUnited/node-request-progress.png)](http://travis-ci.org/IndigoUnited/node-request-progress.png)\n\nTracks the download progress of a request made with [request](https://github.com/mikeal/request).\n\n\n## Installation\n\n`$ npm install request-progress`\n\n\n## Usage\n\n```js\nvar fs = require('fs');\nvar request = require('request');\nvar progress = require('request-progress');\n\n// Note that the options argument is optional\nprogress(request('http://google.com/doodle.png'), {\n throttle: 2000, // Throttle the progress event to 2000ms, defaults to 1000ms\n delay: 1000 // Only start to emit after 1000ms delay, defaults to 0ms\n})\n.on('progress', function (state) {\n console.log('received size in bytes', state.received);\n // The properties bellow can be null if response does not contain\n // the content-length header\n console.log('total size in bytes', state.total);\n console.log('percent', state.percent);\n})\n.on('error', function (err) {\n // Do something with err\n})\n.pipe(fs.createWriteStream('doodle.png'))\n.on('error', function (err) {\n // Do something with err\n})\n.on('close', function (err) {\n // Saved to doogle.png!\n})\n```\n\nNote that the `state` object emitted in the `progress` event is reused to avoid creating a new object for each event.\n\n\n## License\n\nReleased under the [MIT License](http://www.opensource.org/licenses/mit-license.php).\n",
  39. "readmeFilename": "README.md",
  40. "homepage": "https://github.com/IndigoUnited/node-request-progress",
  41. "_id": "request-progress@0.3.0",
  42. "_shasum": "bdf2062bfc197c5d492500d44cb3aff7865b492e",
  43. "_from": "request-progress@0.3.0",
  44. "_resolved": "https://registry.npmjs.org/request-progress/-/request-progress-0.3.0.tgz"
  45. }