package.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. {
  2. "_args": [
  3. [
  4. {
  5. "raw": "form-data@~2.1.1",
  6. "scope": null,
  7. "escapedName": "form-data",
  8. "name": "form-data",
  9. "rawSpec": "~2.1.1",
  10. "spec": ">=2.1.1 <2.2.0",
  11. "type": "range"
  12. },
  13. "/mnt/Data/bach/Documents/ola/OLA#4/OLA#4DOC/sys/node_modules/request"
  14. ]
  15. ],
  16. "_from": "form-data@>=2.1.1 <2.2.0",
  17. "_id": "form-data@2.1.4",
  18. "_inCache": true,
  19. "_location": "/form-data",
  20. "_nodeVersion": "6.10.1",
  21. "_npmOperationalInternal": {
  22. "host": "packages-18-east.internal.npmjs.com",
  23. "tmp": "tmp/form-data-2.1.4.tgz_1491750597266_0.5097400255035609"
  24. },
  25. "_npmUser": {
  26. "name": "alexindigo",
  27. "email": "iam@alexindigo.com"
  28. },
  29. "_npmVersion": "3.10.10",
  30. "_phantomChildren": {},
  31. "_requested": {
  32. "raw": "form-data@~2.1.1",
  33. "scope": null,
  34. "escapedName": "form-data",
  35. "name": "form-data",
  36. "rawSpec": "~2.1.1",
  37. "spec": ">=2.1.1 <2.2.0",
  38. "type": "range"
  39. },
  40. "_requiredBy": [
  41. "/request"
  42. ],
  43. "_resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz",
  44. "_shasum": "33c183acf193276ecaa98143a69e94bfee1750d1",
  45. "_shrinkwrap": null,
  46. "_spec": "form-data@~2.1.1",
  47. "_where": "/mnt/Data/bach/Documents/ola/OLA#4/OLA#4DOC/sys/node_modules/request",
  48. "author": {
  49. "name": "Felix Geisendörfer",
  50. "email": "felix@debuggable.com",
  51. "url": "http://debuggable.com/"
  52. },
  53. "browser": "./lib/browser",
  54. "bugs": {
  55. "url": "https://github.com/form-data/form-data/issues"
  56. },
  57. "dependencies": {
  58. "asynckit": "^0.4.0",
  59. "combined-stream": "^1.0.5",
  60. "mime-types": "^2.1.12"
  61. },
  62. "description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
  63. "devDependencies": {
  64. "browserify": "^13.1.1",
  65. "browserify-istanbul": "^2.0.0",
  66. "coveralls": "^2.11.14",
  67. "cross-spawn": "^4.0.2",
  68. "eslint": "^3.9.1",
  69. "fake": "^0.2.2",
  70. "far": "^0.0.7",
  71. "formidable": "^1.0.17",
  72. "in-publish": "^2.0.0",
  73. "is-node-modern": "^1.0.0",
  74. "istanbul": "^0.4.5",
  75. "obake": "^0.1.2",
  76. "phantomjs-prebuilt": "^2.1.13",
  77. "pkgfiles": "^2.3.0",
  78. "pre-commit": "^1.1.3",
  79. "request": "2.76.0",
  80. "rimraf": "^2.5.4",
  81. "tape": "^4.6.2"
  82. },
  83. "directories": {},
  84. "dist": {
  85. "shasum": "33c183acf193276ecaa98143a69e94bfee1750d1",
  86. "tarball": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz"
  87. },
  88. "engines": {
  89. "node": ">= 0.12"
  90. },
  91. "gitHead": "d7398c3e7cd81ed12ecc0b84363721bae467db02",
  92. "homepage": "https://github.com/form-data/form-data#readme",
  93. "license": "MIT",
  94. "main": "./lib/form_data",
  95. "maintainers": [
  96. {
  97. "name": "alexindigo",
  98. "email": "iam@alexindigo.com"
  99. },
  100. {
  101. "name": "dylanpiercey",
  102. "email": "pierceydylan@gmail.com"
  103. },
  104. {
  105. "name": "felixge",
  106. "email": "felix@debuggable.com"
  107. },
  108. {
  109. "name": "mikeal",
  110. "email": "mikeal.rogers@gmail.com"
  111. }
  112. ],
  113. "name": "form-data",
  114. "optionalDependencies": {},
  115. "pre-commit": [
  116. "lint",
  117. "ci-test",
  118. "check"
  119. ],
  120. "readme": "# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data)\n\nA library to create readable ```\"multipart/form-data\"``` streams. Can be used to submit forms and file uploads to other web applications.\n\nThe API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].\n\n[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface\n\n[![Linux Build](https://img.shields.io/travis/form-data/form-data/v2.1.4.svg?label=linux:0.12-6.x)](https://travis-ci.org/form-data/form-data)\n[![MacOS Build](https://img.shields.io/travis/form-data/form-data/v2.1.4.svg?label=macos:0.12-6.x)](https://travis-ci.org/form-data/form-data)\n[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/form-data/v2.1.4.svg?label=windows:0.12-6.x)](https://ci.appveyor.com/project/alexindigo/form-data)\n\n[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v2.1.4.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master)\n[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data)\n[![bitHound Overall Score](https://www.bithound.io/github/form-data/form-data/badges/score.svg)](https://www.bithound.io/github/form-data/form-data)\n\n## Install\n\n```\nnpm install --save form-data\n```\n\n## Usage\n\nIn this example we are constructing a form with 3 fields that contain a string,\na buffer and a file stream.\n\n``` javascript\nvar FormData = require('form-data');\nvar fs = require('fs');\n\nvar form = new FormData();\nform.append('my_field', 'my value');\nform.append('my_buffer', new Buffer(10));\nform.append('my_file', fs.createReadStream('/foo/bar.jpg'));\n```\n\nAlso you can use http-response stream:\n\n``` javascript\nvar FormData = require('form-data');\nvar http = require('http');\n\nvar form = new FormData();\n\nhttp.request('http://nodejs.org/images/logo.png', function(response) {\n form.append('my_field', 'my value');\n form.append('my_buffer', new Buffer(10));\n form.append('my_logo', response);\n});\n```\n\nOr @mikeal's [request](https://github.com/request/request) stream:\n\n``` javascript\nvar FormData = require('form-data');\nvar request = require('request');\n\nvar form = new FormData();\n\nform.append('my_field', 'my value');\nform.append('my_buffer', new Buffer(10));\nform.append('my_logo', request('http://nodejs.org/images/logo.png'));\n```\n\nIn order to submit this form to a web application, call ```submit(url, [callback])``` method:\n\n``` javascript\nform.submit('http://example.org/', function(err, res) {\n // res – response object (http.IncomingMessage) //\n res.resume();\n});\n\n```\n\nFor more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.\n\n### Alternative submission methods\n\nYou can use node's http client interface:\n\n``` javascript\nvar http = require('http');\n\nvar request = http.request({\n method: 'post',\n host: 'example.org',\n path: '/upload',\n headers: form.getHeaders()\n});\n\nform.pipe(request);\n\nrequest.on('response', function(res) {\n console.log(res.statusCode);\n});\n```\n\nOr if you would prefer the `'Content-Length'` header to be set for you:\n\n``` javascript\nform.submit('example.org/upload', function(err, res) {\n console.log(res.statusCode);\n});\n```\n\nTo use custom headers and pre-known length in parts:\n\n``` javascript\nvar CRLF = '\\r\\n';\nvar form = new FormData();\n\nvar options = {\n header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,\n knownLength: 1\n};\n\nform.append('my_buffer', buffer, options);\n\nform.submit('http://example.com/', function(err, res) {\n if (err) throw err;\n console.log('Done');\n});\n```\n\nForm-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide \"file\"-related information manually:\n\n``` javascript\nsomeModule.stream(function(err, stdout, stderr) {\n if (err) throw err;\n\n var form = new FormData();\n\n form.append('file', stdout, {\n filename: 'unicycle.jpg',\n contentType: 'image/jpg',\n knownLength: 19806\n });\n\n form.submit('http://example.com/', function(err, res) {\n if (err) throw err;\n console.log('Done');\n });\n});\n```\n\nFor edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:\n\n``` javascript\nform.submit({\n host: 'example.com',\n path: '/probably.php?extra=params',\n auth: 'username:password'\n}, function(err, res) {\n console.log(res.statusCode);\n});\n```\n\nIn case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`:\n\n``` javascript\nform.submit({\n host: 'example.com',\n path: '/surelynot.php',\n headers: {'x-test-header': 'test-header-value'}\n}, function(err, res) {\n console.log(res.statusCode);\n});\n```\n\n### Integration with other libraries\n\n#### Request\n\nForm submission using [request](https://github.com/request/request):\n\n```javascript\nvar formData = {\n my_field: 'my_value',\n my_file: fs.createReadStream(__dirname + '/unicycle.jpg'),\n};\n\nrequest.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) {\n if (err) {\n return console.error('upload failed:', err);\n }\n console.log('Upload successful! Server responded with:', body);\n});\n```\n\nFor more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads).\n\n#### node-fetch\n\nYou can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch):\n\n```javascript\nvar form = new FormData();\n\nform.append('a', 1);\n\nfetch('http://example.com', { method: 'POST', body: form })\n .then(function(res) {\n return res.json();\n }).then(function(json) {\n console.log(json);\n });\n```\n\n## Notes\n\n- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.\n- Starting version `2.x` FormData has dropped support for `node@0.10.x`.\n\n## License\n\nForm-Data is released under the [MIT](License) license.\n",
  121. "readmeFilename": "README.md",
  122. "repository": {
  123. "type": "git",
  124. "url": "git://github.com/form-data/form-data.git"
  125. },
  126. "scripts": {
  127. "browser": "browserify -t browserify-istanbul test/run-browser.js | obake --coverage",
  128. "check": "istanbul check-coverage coverage/coverage*.json",
  129. "ci-lint": "is-node-modern 6 && npm run lint || is-node-not-modern 6",
  130. "ci-test": "npm run test && npm run browser && npm run report",
  131. "debug": "verbose=1 ./test/run.js",
  132. "files": "pkgfiles --sort=name",
  133. "get-version": "node -e \"console.log(require('./package.json').version)\"",
  134. "lint": "eslint lib/*.js test/*.js test/integration/*.js",
  135. "postpublish": "npm run restore-readme",
  136. "posttest": "istanbul report lcov text",
  137. "predebug": "rimraf coverage test/tmp",
  138. "prepublish": "in-publish && npm run update-readme || not-in-publish",
  139. "pretest": "rimraf coverage test/tmp",
  140. "report": "istanbul report lcov text",
  141. "restore-readme": "mv README.md.bak README.md",
  142. "test": "istanbul cover test/run.js",
  143. "update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md"
  144. },
  145. "version": "2.1.4"
  146. }