{"name":"formidable","version":"1.2.6","license":"MIT","description":"(DEPRECATED! Install formidable@v2) A node.js module for parsing form data, especially file uploads.","homepage":"https://github.com/node-formidable/formidable","funding":"https://ko-fi.com/tunnckoCore/commissions","repository":{"type":"git","url":"git+https://github.com/node-formidable/formidable.git"},"main":"./lib/index.js","publishConfig":{"access":"public","tag":"v1"},"devDependencies":{"gently":"^0.8.0","findit":"^0.1.2","hashish":"^0.0.4","urun":"^0.0.6","utest":"^0.0.8","request":"^2.11.4"},"scripts":{"test":"node test/run.js","clean":"rm test/tmp/*"},"readme":"<p align=\"center\">\n  <img alt=\"npm formidable package logo\" src=\"https://raw.githubusercontent.com/node-formidable/formidable/master/logo.png\" />\n</p>\n\n# formidable [![npm version][npmv-img]][npmv-url] [![MIT license][license-img]][license-url] [![Libera Manifesto][libera-manifesto-img]][libera-manifesto-url]\n\n> A Node.js module for parsing form data, especially file uploads.\n\n### Important Notes\n\nFor more info, check the [CHANGELOG](https://github.com/node-formidable/formidable/blob/master/CHANGELOG.md) on the master branch.\n\n#### v1 is deprecated\n\nAll `v1` versions are deprecated in NPM for over 2 years. You can find it at `formidable@v1` or `formidable@legacy` on NPM, and on [v1-legacy branch][v1branch] on GitHub.  \nWe highly recommend to use `v2` or `v3`. Both are already in use by many, especially `v2` which was on `formidable@canary` for 2 years.\n\n- **Status: Not Maintained!**\n- We won't provide support or accept reports on that version.\n- **No Backporting:** bugfixes, security fixes, or new features WILL NOT happen!\n- Please move to at least **v2**! \n- Try with installing `formidable@v2` and if still have the problem - report!\n\n---\n\n#### v2 is the new `latest`\nThe `v2` will be simultaneously on two places for some time - `formidable@latest` and `formidable@v2`.\nThe source code be available **only** on [v2 branch][v2branch].\nIf you want to use v2, it's recommended to use the v2 dist-tag `formidable@v2`. \n\n**Main Differences from v1:**\n- Better organization and modernized code, requiring newer Node.js versions (>= v10).\n- A lot of bugfixes, closed issues, merged or closed PRs.\n- **Backward compatible to v1!** Should not have problems, the major version bump is just for ensurance.\n- Better docs, new features (plugins, parsers, options) and optimizations.\n\n---\n\n#### v3 - ESModules, Promises, Monorepo structure\nWe recommend to use `formidable@v3`, as it uses more modern Node.js Streams, has support for Promises and more stuff.\nYou can see more info and track some ideas on [issue#635](https://github.com/node-formidable/formidable/issues/635).\n\n- The source code can be found on the [master branch](https://github.com/node-formidable/formidable) on GitHub.\n- It will be published on `formidable@latest` after some time.\n- Dropping older Node.js versions, requiring higher than v12-v14.\n- Dropping v1 compatibility.\n- Rewritten to ESModules, more optimizations.\n- Moving to monorepo structure, more plugins & helper utils.\n\n[v1branch]: https://github.com/node-formidable/formidable/tree/v1-legacy\n[v2branch]: https://github.com/node-formidable/formidable/tree/v2\n[v3branch]: https://github.com/node-formidable/formidable/tree/v3\n\n---\n\n[![Code style][codestyle-img]][codestyle-url]\n[![codecoverage][codecov-img]][codecov-url]\n[![linux build status][linux-build-img]][build-url]\n[![windows build status][windows-build-img]][build-url]\n[![macos build status][macos-build-img]][build-url]\n\nIf you have any _how-to_ kind of questions, please read the [Contributing\nGuide][contributing-url] and [Code of Conduct][code_of_conduct-url]\ndocuments.<br /> For bugs reports and feature requests, [please create an\nissue][open-issue-url] or ping [@tunnckoCore](https://twitter.com/tunnckoCore)\nat Twitter.\n\n[![Conventional Commits][ccommits-img]][ccommits-url]\n[![Minimum Required Nodejs][nodejs-img]][npmv-url]\n[![Tidelift Subcsription][tidelift-img]][tidelift-url]\n[![Buy me a Kofi][kofi-img]][kofi-url]\n[![Renovate App Status][renovateapp-img]][renovateapp-url]\n[![Make A Pull Request][prs-welcome-img]][prs-welcome-url]\n\nThis project is [semantically versioned](https://semver.org) and available as\npart of the [Tidelift Subscription][tidelift-url] for professional grade\nassurances, enhanced support and security.\n[Learn more.](https://tidelift.com/subscription/pkg/npm-formidable?utm_source=npm-formidable&utm_medium=referral&utm_campaign=enterprise)\n\n_The maintainers of `formidable` and thousands of other packages are working\nwith Tidelift to deliver commercial support and maintenance for the Open Source\ndependencies you use to build your applications. Save time, reduce risk, and\nimprove code health, while paying the maintainers of the exact dependencies you\nuse._\n\n[![][npm-weekly-img]][npmv-url] [![][npm-monthly-img]][npmv-url]\n[![][npm-yearly-img]][npmv-url] [![][npm-alltime-img]][npmv-url]\n\n## v1 status: not maintained!\n\n## Project Status: Maintained\n\nThis module was initially developed by\n[**@felixge**](https://github.com/felixge) for\n[Transloadit](http://transloadit.com/), a service focused on uploading and\nencoding images and videos. It has been battle-tested against hundreds of GBs of\nfile uploads from a large variety of clients and is considered production-ready\nand is used in production for years.\n\nCurrently, we are few maintainers trying to deal with it. :) More contributors\nare always welcome! :heart: Jump on\n[issue #412](https://github.com/felixge/node-formidable/issues/412) which is\nclosed, but if you are interested we can discuss it and add you after strict\nrules, like enabling Two-Factor Auth in your npm and GitHub accounts.\n\n## Features\n\n* Fast (~500mb/sec), non-buffering multipart parser\n* Automatically writing file uploads to disk\n* Low memory footprint\n* Graceful error handling\n* Very high test coverage\n\n## Installation\n\n```sh\nnpm install formidable@v1\nnpm install formidable@v2\nnpm install formidable@v3\n```\n\nThis is a low-level package, and if you're using a high-level framework it may already be included. However, [Express v4](http://expressjs.com) does not include any multipart handling, nor does [body-parser](https://github.com/expressjs/body-parser).\n\nNote: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library.\n\n## Example\n\nParse an incoming file upload.\n```javascript\nvar formidable = require('formidable'),\n    http = require('http'),\n    util = require('util');\n\nhttp.createServer(function(req, res) {\n  if (req.url == '/upload' && req.method.toLowerCase() == 'post') {\n    // parse a file upload\n    var form = new formidable.IncomingForm();\n\n    form.parse(req, function(err, fields, files) {\n      res.writeHead(200, {'content-type': 'text/plain'});\n      res.write('received upload:\\n\\n');\n      res.end(util.inspect({fields: fields, files: files}));\n    });\n\n    return;\n  }\n\n  // show a file upload form\n  res.writeHead(200, {'content-type': 'text/html'});\n  res.end(\n    '<form action=\"/upload\" enctype=\"multipart/form-data\" method=\"post\">'+\n    '<input type=\"text\" name=\"title\"><br>'+\n    '<input type=\"file\" name=\"upload\" multiple=\"multiple\"><br>'+\n    '<input type=\"submit\" value=\"Upload\">'+\n    '</form>'\n  );\n}).listen(8080);\n```\n## API\n\n### Formidable.IncomingForm\n```javascript\nvar form = new formidable.IncomingForm()\n```\nCreates a new incoming form.\n\n```javascript\nform.encoding = 'utf-8';\n```\nSets encoding for incoming form fields.\n\n```javascript\nform.uploadDir = \"/my/dir\";\n```\nSets the directory for placing file uploads in. You can move them later on using\n`fs.rename()`. The default is `os.tmpdir()`.\n\n```javascript\nform.keepExtensions = false;\n```\nIf you want the files written to `form.uploadDir` to include the extensions of the original files, set this property to `true`.\n\n```javascript\nform.type\n```\nEither 'multipart' or 'urlencoded' depending on the incoming request.\n\n```javascript\nform.maxFieldsSize = 20 * 1024 * 1024;\n```\nLimits the amount of memory all fields together (except files) can allocate in bytes.\nIf this value is exceeded, an `'error'` event is emitted. The default\nsize is 20MB.\n\n```javascript\nform.maxFileSize = 200 * 1024 * 1024;\n```\nLimits the size of uploaded file.\nIf this value is exceeded, an `'error'` event is emitted. The default\nsize is 200MB.\n\n```javascript\nform.maxFields = 1000;\n```\nLimits the number of fields that the querystring parser will decode. Defaults\nto 1000 (0 for unlimited).\n\n```javascript\nform.hash = false;\n```\nIf you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`.\n\n```javascript\nform.multiples = false;\n```\nIf this option is enabled, when you call `form.parse`, the `files` argument will contain arrays of files for inputs which submit multiple files using the HTML5 `multiple` attribute.\n\n```javascript\nform.bytesReceived\n```\nThe amount of bytes received for this form so far.\n\n```javascript\nform.bytesExpected\n```\nThe expected number of bytes in this form.\n\n```javascript\nform.parse(request, [cb]);\n```\nParses an incoming node.js `request` containing form data. If `cb` is provided, all fields and files are collected and passed to the callback:\n\n\n```javascript\nform.parse(req, function(err, fields, files) {\n  // ...\n});\n\nform.onPart(part);\n```\nYou may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events  processing which would occur otherwise, making you fully responsible for handling the processing.\n\n```javascript\nform.onPart = function(part) {\n  part.addListener('data', function() {\n    // ...\n  });\n}\n```\nIf you want to use formidable to only handle certain parts for you, you can do so:\n```javascript\nform.onPart = function(part) {\n  if (!part.filename) {\n    // let formidable handle all non-file parts\n    form.handlePart(part);\n  }\n}\n```\nCheck the code in this method for further inspiration.\n\n\n### Formidable.File\n```javascript\nfile.size = 0\n```\nThe size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet.\n```javascript\nfile.path = null\n```\nThe path this file is being written to. You can modify this in the `'fileBegin'` event in\ncase you are unhappy with the way formidable generates a temporary path for your files.\n```javascript\nfile.name = null\n```\nThe name this file had according to the uploading client.\n```javascript\nfile.type = null\n```\nThe mime type of this file, according to the uploading client.\n```javascript\nfile.lastModifiedDate = null\n```\nA date object (or `null`) containing the time this file was last written to. Mostly\nhere for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/).\n```javascript\nfile.hash = null\n```\nIf hash calculation was set, you can read the hex digest out of this var.\n\n#### Formidable.File#toJSON()\n\n  This method returns a JSON-representation of the file, allowing you to\n  `JSON.stringify()` the file which is useful for logging and responding\n  to requests.\n\n### Events\n\n\n#### 'progress'\n\nEmitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar.\n\n```javascript\nform.on('progress', function(bytesReceived, bytesExpected) {\n});\n```\n\n\n\n#### 'field'\n\nEmitted whenever a field / value pair has been received.\n\n```javascript\nform.on('field', function(name, value) {\n});\n```\n\n#### 'fileBegin'\n\nEmitted whenever a new file is detected in the upload stream. Use this event if\nyou want to stream the file to somewhere else while buffering the upload on\nthe file system.\n\n```javascript\nform.on('fileBegin', function(name, file) {\n});\n```\n\n#### 'file'\n\nEmitted whenever a field / file pair has been received. `file` is an instance of `File`.\n\n```javascript\nform.on('file', function(name, file) {\n});\n```\n\n#### 'error'\n\nEmitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events.\n\n```javascript\nform.on('error', function(err) {\n});\n```\n\n#### 'aborted'\n\n\nEmitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. After this event is emitted, an `error` event will follow. In the future there will be a separate 'timeout' event (needs a change in the node core).\n```javascript\nform.on('aborted', function() {\n});\n```\n\n##### 'end'\n```javascript\nform.on('end', function() {\n});\n```\nEmitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response.\n\n\n\n## Changelog\n\n[./CHANGELOG.md](./CHANGELOG.md)\n\n## Credits\n\n- [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++\n  parser based on formidable\n- [Ryan Dahl](http://twitter.com/ryah) for his work on\n  [http-parser](http://github.com/ry/http-parser) which heavily inspired the\n  initial `multipart_parser.js`.\n\nFrom [Felix blog post](https://felixge.de/2013/03/11/the-pull-request-hack/):\n\n- [Sven Lito](https://github.com/svnlto) for fixing bugs and merging patches\n- [egirshov](https://github.com/egirshov) for contributing many improvements to the node-formidable multipart parser\n- [Andrew Kelley](https://github.com/superjoe30) for also helping with fixing bugs and making improvements\n- [Mike Frey](https://github.com/mikefrey) for contributing JSON support\n\n\n## Contributing\n\nIf the documentation is unclear or has a typo, please click on the page's `Edit`\nbutton (pencil icon) and suggest a correction. If you would like to help us fix\na bug or add a new feature, please check our [Contributing\nGuide][contributing-url]. Pull requests are welcome!\n\n\n## License\n\nFormidable is licensed under the [MIT License][license-url].\n\n<!-- badges -->\n<!-- prettier-ignore-start -->\n\n[codestyle-url]: https://github.com/airbnb/javascript\n[codestyle-img]: https://badgen.net/badge/code%20style/airbnb%20%2B%20prettier/ff5a5f?icon=airbnb&cache=300\n[codecov-url]: https://codecov.io/gh/node-formidable/formidable\n[codecov-img]: https://badgen.net/codecov/c/github/node-formidable/formidable/master?icon=codecov\n[npmv-canary-img]: https://badgen.net/npm/v/formidable/canary?icon=npm\n[npmv-dev-img]: https://badgen.net/npm/v/formidable/dev?icon=npm\n[npmv-img]: https://badgen.net/npm/v/formidable?icon=npm\n[npmv-url]: https://npmjs.com/package/formidable\n[license-img]: https://badgen.net/npm/license/formidable\n[license-url]: https://github.com/node-formidable/formidable/blob/master/LICENSE\n[chat-img]: https://badgen.net/badge/chat/on%20gitter/46BC99?icon=gitter\n[chat-url]: https://gitter.im/node-formidable/Lobby\n[libera-manifesto-url]: https://liberamanifesto.com\n[libera-manifesto-img]: https://badgen.net/badge/libera/manifesto/grey\n[renovateapp-url]: https://renovatebot.com\n[renovateapp-img]: https://badgen.net/badge/renovate/enabled/green?cache=300\n[prs-welcome-img]: https://badgen.net/badge/PRs/welcome/green?cache=300\n[prs-welcome-url]: http://makeapullrequest.com\n[twitter-url]: https://twitter.com/tunnckoCore\n[twitter-img]: https://badgen.net/twitter/follow/tunnckoCore?icon=twitter&color=1da1f2&cache=300\n\n[npm-weekly-img]: https://badgen.net/npm/dw/formidable?icon=npm&cache=300\n[npm-monthly-img]: https://badgen.net/npm/dm/formidable?icon=npm&cache=300\n[npm-yearly-img]: https://badgen.net/npm/dy/formidable?icon=npm&cache=300\n[npm-alltime-img]: https://badgen.net/npm/dt/formidable?icon=npm&cache=300&label=total%20downloads\n\n[nodejs-img]: https://badgen.net/badge/node/>=%2010.13/green?cache=300\n\n[ccommits-url]: https://conventionalcommits.org/\n[ccommits-img]: https://badgen.net/badge/conventional%20commits/v1.0.0/green?cache=300\n\n[contributing-url]: https://github.com/node-formidable/.github/blob/master/CONTRIBUTING.md\n[code_of_conduct-url]: https://github.com/node-formidable/.github/blob/master/CODE_OF_CONDUCT.md\n\n[open-issue-url]: https://github.com/node-formidable/formidable/issues/new\n\n[tidelift-url]: https://tidelift.com/subscription/pkg/npm-formidable?utm_source=npm-formidable&utm_medium=referral&utm_campaign=enterprise\n[tidelift-img]: https://badgen.net/badge/tidelift/subscription/4B5168?labelColor=F6914D\n\n[kofi-url]: https://ko-fi.com/tunnckoCore/commissions\n[kofi-img]: https://badgen.net/badge/ko-fi/support/29abe0c2?cache=300&icon=https://rawcdn.githack.com/tunnckoCore/badgen-icons/f8264c6414e0bec449dd86f2241d50a9b89a1203/icons/kofi.svg\n\n[linux-build-img]: https://badgen.net/github/checks/node-formidable/formidable/master/ubuntu?cache=300&label=linux%20build&icon=github\n[macos-build-img]: https://badgen.net/github/checks/node-formidable/formidable/master/macos?cache=300&label=macos%20build&icon=github\n[windows-build-img]: https://badgen.net//github/checks/node-formidable/formidable/master/windows?cache=300&label=windows%20build&icon=github\n[build-url]: https://github.com/node-formidable/formidable/actions?query=workflow%3Anodejs\n<!-- prettier-ignore-end -->\n\n","readmeFilename":"Readme.md","gitHead":"f1d43172da4f8f299f6d84884109809c7ca80422","bugs":{"url":"https://github.com/node-formidable/formidable/issues"},"_id":"formidable@1.2.6","_nodeVersion":"16.8.0","_npmVersion":"8.1.2","dist":{"integrity":"sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==","shasum":"d2a51d60162bbc9b4a055d8457a7c75315d1a168","tarball":"http://registry-npm.ywwl.com/formidable/download/formidable-1.2.6.tgz","fileCount":10,"unpackedSize":44280,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC8v/C6XM8iNt53QOF7YxZ3te7+MZCUlWMsJcNIIGXwJgIgLobA6myaMN6QyxPq/WEArQS7wxNkAp2NLuDl1ni6+50="}],"size":13632,"noattachment":false,"key":"/formidable/-/formidable-1.2.6.tgz"},"_npmUser":{"name":"tunnckocore","email":"dev@tunnckocore.anonaddy.com"},"directories":{},"maintainers":[{"name":"felixge","email":"felix@debuggable.com"},{"name":"kornel","email":"npmspam@geekhood.net"},{"name":"grossacasacs","email":"cyril.walle@protonmail.com"},{"name":"tunnckocore","email":"dev@tunnckocore.anonaddy.com"},{"name":"quantumsheep","email":"nathanael.dmc@outlook.fr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/formidable_1.2.6_1635626132443_0.6340846094264292"},"_hasShrinkwrap":false,"deprecated":"Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau","publish_time":1635626132637,"_cnpm_publish_time":1635626132637,"dist-tags":{"latest":"3.5.4","legacy":"1.2.6","next":"4.0.0-rc.6","v1":"1.2.6","v2-latest":"2.1.5"}}