pnpm
Version:
Fast, disk space efficient package manager
151 lines (150 loc) • 12.8 kB
JSON
{
"_args": [
[
{
"raw": "form-data@~2.3.2",
"scope": null,
"escapedName": "form-data",
"name": "form-data",
"rawSpec": "~2.3.2",
"spec": ">=2.3.2 <2.4.0",
"type": "range"
},
"/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/request"
]
],
"_from": "form-data@~2.3.2",
"_hasShrinkwrap": false,
"_id": "form-data@2.3.3",
"_location": "/form-data",
"_nodeVersion": "8.11.3",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/form-data_2.3.3_1539761182623_0.0008897599197468242"
},
"_npmUser": {
"name": "alexindigo",
"email": "iam@alexindigo.com"
},
"_npmVersion": "5.6.0",
"_phantomChildren": {},
"_requested": {
"raw": "form-data@~2.3.2",
"scope": null,
"escapedName": "form-data",
"name": "form-data",
"rawSpec": "~2.3.2",
"spec": ">=2.3.2 <2.4.0",
"type": "range"
},
"_requiredBy": [
"/request"
],
"_resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"_shasum": "dcce52c05f644f298c6a7ab936bd724ceffbf3a6",
"_shrinkwrap": null,
"_spec": "form-data@~2.3.2",
"_where": "/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/request",
"author": {
"name": "Felix Geisendörfer",
"email": "felix@debuggable.com",
"url": "http://debuggable.com/"
},
"browser": "./lib/browser",
"bugs": {
"url": "https://github.com/form-data/form-data/issues"
},
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
},
"description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
"devDependencies": {
"browserify": "^13.1.1",
"browserify-istanbul": "^2.0.0",
"coveralls": "^2.11.14",
"cross-spawn": "^4.0.2",
"eslint": "^3.9.1",
"fake": "^0.2.2",
"far": "^0.0.7",
"formidable": "^1.0.17",
"in-publish": "^2.0.0",
"is-node-modern": "^1.0.0",
"istanbul": "^0.4.5",
"obake": "^0.1.2",
"phantomjs-prebuilt": "^2.1.13",
"pkgfiles": "^2.3.0",
"pre-commit": "^1.1.3",
"request": "2.76.0",
"rimraf": "^2.5.4",
"tape": "^4.6.2"
},
"directories": {},
"dist": {
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
"shasum": "dcce52c05f644f298c6a7ab936bd724ceffbf3a6",
"tarball": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"fileCount": 8,
"unpackedSize": 119230,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbxuQfCRA9TVsSAnZWagAAiRgP/35Rr4anNT4tkKaF5BjA\nqyn2Rqik/V1A2uEXoVRZjwFAn4c3xH8riq4suJeOS0LbjaPoj6pWJXdiYkdN\nT2MCeTfUsGbT+LY5s2WOXQsDD5I78MzG88jn5QLSiNc72kbqmCAw2lDTr3b6\nm1ds6tFRb8xdkSGloXjpZ7BY/mex1Mkx+MS9pcXOVU9K7w8NbFXzRGO+A1Zh\ng5bQvcWjm98IjC6PRutLhbp4g4v502zpdYDRXtVW6w5fnC7uN7Mcv2GraRqN\nFIGEDhhcTeGomrb62Ea3imTiTkUliRvE7tSwGPJz894Rq1ej66oP/wfkF3yL\npe0DEAHlpqoG2328Fkcrzy1+dKxaqSqGf2LSGIPUNrjF76bPY+3VpXAcMS+h\nGK9brzI9I5KAfdJ6Gbgj2IX/A6xtIV5Ru7/kc2diVFIWkZXGaIQZVmho7Xkz\nMc3kLnIzT92b1xkk4bxiVFnLq7UaiheTEUxn8A1V8k1wWLMebJfndK3fMKJ8\n0fZKgPaPk+qG9J9Ld1AZWXZPg8nO06PkpCNwtb0TaUP7j2meQzjRqrCJqz+c\nuQwFbhQqEsT6TKd98dY7tcKKQf4t5hWL8InjeiqQ3+fe5Yehn264oKnJcnTo\ndHIKlpiqxdP9Natp/cCM6zCYcORN1mEinwf8zalChSk+XVCQ3NGKsHWywVc6\nZCxO\r\n=NorT\r\n-----END PGP SIGNATURE-----\r\n"
},
"engines": {
"node": ">= 0.12"
},
"gitHead": "b16916a568a0d06f3f8a16c31f9a8b89b7844094",
"homepage": "https://github.com/form-data/form-data#readme",
"license": "MIT",
"main": "./lib/form_data",
"maintainers": [
{
"name": "alexindigo",
"email": "iam@alexindigo.com"
},
{
"name": "dylanpiercey",
"email": "pierceydylan@gmail.com"
},
{
"name": "felixge",
"email": "felix@debuggable.com"
},
{
"name": "mikeal",
"email": "mikeal.rogers@gmail.com"
}
],
"name": "form-data",
"optionalDependencies": {},
"pre-commit": [
"lint",
"ci-test",
"check"
],
"readme": "# Form-Data [](https://www.npmjs.com/package/form-data) [](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[](https://travis-ci.org/form-data/form-data)\n[](https://travis-ci.org/form-data/form-data)\n[](https://ci.appveyor.com/project/alexindigo/form-data)\n\n[](https://coveralls.io/github/form-data/form-data?branch=master)\n[](https://david-dm.org/form-data/form-data)\n[](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### Custom options\n\nYou can provide custom options, such as `maxDataSize`:\n\n``` javascript\nvar FormData = require('form-data');\n\nvar form = new FormData({ maxDataSize: 20971520 });\nform.append('my_field', 'my value');\nform.append('my_buffer', /* something big */);\n```\n\nList of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15)\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', // ... or:\n filepath: 'photos/toys/unicycle.jpg',\n contentType: 'image/jpeg',\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\nThe `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory).\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",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git://github.com/form-data/form-data.git"
},
"scripts": {
"browser": "browserify -t browserify-istanbul test/run-browser.js | obake --coverage",
"check": "istanbul check-coverage coverage/coverage*.json",
"ci-lint": "is-node-modern 6 && npm run lint || is-node-not-modern 6",
"ci-test": "npm run test && npm run browser && npm run report",
"debug": "verbose=1 ./test/run.js",
"files": "pkgfiles --sort=name",
"get-version": "node -e \"console.log(require('./package.json').version)\"",
"lint": "eslint lib/*.js test/*.js test/integration/*.js",
"postpublish": "npm run restore-readme",
"posttest": "istanbul report lcov text",
"predebug": "rimraf coverage test/tmp",
"prepublish": "in-publish && npm run update-readme || not-in-publish",
"pretest": "rimraf coverage test/tmp",
"report": "istanbul report lcov text",
"restore-readme": "mv README.md.bak README.md",
"test": "istanbul cover test/run.js",
"update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md"
},
"version": "2.3.3"
}