{
  "name": "multiparty",
  "version": "2.1.8",
  "description": "multipart/form-data parser which supports streaming",
  "repository": {
    "type": "git",
    "url": "git@github.com:superjoe30/node-multiparty.git"
  },
  "keywords": [
    "file",
    "upload",
    "formidable",
    "stream",
    "s3"
  ],
  "devDependencies": {
    "findit": "0.1.1",
    "hashish": "0.0.4",
    "mocha": "~1.8.2",
    "request": "~2.16.6",
    "mkdirp": "~0.3.5",
    "superagent": "~0.14.1"
  },
  "scripts": {
    "test": "mocha --reporter spec --recursive test/test.js"
  },
  "engines": {
    "node": ">=0.8.0"
  },
  "license": "MIT",
  "dependencies": {
    "readable-stream": "~1.0.2",
    "stream-counter": "~0.1.0"
  },
  "readme": "[![Build Status](https://travis-ci.org/superjoe30/node-multiparty.png?branch=master)](https://travis-ci.org/superjoe30/node-multiparty)\n# multiparty\n\nParse http requests with content-type `multipart/form-data`, also known as file uploads.\n\n### Why the fork?\n\n * This module uses the Node.js v0.10 streams properly, *even in Node.js v0.8*\n * It will not create a temp file for you unless you want it to.\n * Counts bytes and does math to help you figure out the `Content-Length` of\n   each part.\n * You can easily stream uploads to s3 with\n   [knox](https://github.com/LearnBoost/knox), for [example](examples/s3.js).\n * Less bugs. This code is simpler, has all deprecated functionality removed,\n   has cleaner tests, and does not try to do anything beyond multipart stream\n   parsing.\n\n## Installation\n\n```\nnpm install multiparty\n```\n\n## Usage\n\n * See [examples](examples).\n * Using express or connect? See [connect-multiparty](https://github.com/superjoe30/connect-multiparty)\n\nParse an incoming `multipart/form-data` request.\n\n```js\nvar multiparty = require('multiparty')\n  , http = require('http')\n  , util = require('util')\n\nhttp.createServer(function(req, res) {\n  if (req.url === '/upload' && req.method === 'POST') {\n    // parse a file upload\n    var form = new multiparty.Form();\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\n## API\n\n### multiparty.Form\n```js\nvar form = new multiparty.Form(options)\n```\nCreates a new form. Options:\n\n * `encoding` - sets encoding for the incoming form fields. Defaults to `utf8`.\n * `maxFieldSize` - Limits the amount of memory a field (not a file) can\n   allocate in bytes. If this value is exceeded, an `error` event is emitted.\n   The default size is 2MB.\n * `maxFields` - Limits the number of fields that will be parsed before\n   emitting an `error` event. A file counts as a field in this case.\n   Defaults to 1000.\n * `autoFields` - Enables `field` events. This is automatically set to `true`\n   if you add a `field` listener.\n * `autoFiles` - Enables `file` events. This is automatically set to `true`\n   if you add a `file` listener.\n * `uploadDir` - Only relevant when `autoFiles` is `true`. The directory for\n   placing file uploads in. You can move them later using `fs.rename()`.\n   Defaults to `os.tmpDir()`.\n * `hash` - Only relevant when `autoFiles` is `true`. If you want checksums\n   calculated for incoming files, set this to either `sha1` or `md5`.\n   Defaults to off.\n\n#### form.parse(request, [cb])\n\nParses an incoming node.js `request` containing form data. If `cb` is\nprovided, `autoFields` and `autoFiles` are set to `true` and all fields and\nfiles are collected and passed to the callback:\n\n```js\nform.parse(req, function(err, fields, files) {\n  // ...\n});\n```\n\n#### form.bytesReceived\n\nThe amount of bytes received for this form so far.\n\n#### form.bytesExpected\n\nThe expected number of bytes in this form.\n\n### Events\n\n#### 'error' (err)\n\nYou definitely want to handle this event. If not your server *will* crash when\nusers submit bogus multipart requests!\n\n#### 'part' (part)\n\nEmitted when a part is encountered in the request. `part` is a\n`ReadableStream`. It also has the following properties:\n\n * `headers` - the headers for this part. For example, you may be interested\n   in `content-type`.\n * `name` - the field name for this part\n * `filename` - only if the part is an incoming file\n * `byteOffset` - the byte offset of this part in the request body\n * `byteCount` - assuming that this is the last part in the request,\n   this is the size of this part in bytes. You could use this, for\n   example, to set the `Content-Length` header if uploading to S3.\n   If the part had a `Content-Length` header then that value is used\n   here instead.\n\n#### 'aborted'\n\nEmitted when the request is aborted. This event will be followed shortly\nby an `error` event. In practice you do not need to handle this event.\n\n#### 'progress' (bytesReceived, bytesExpected)\n\n#### 'close'\n\nEmitted after all parts have been parsed and emitted. Not emitted if an `error`\nevent is emitted. This is typically when you would send your response.\n\n#### 'file' (name, file)\n\n**By default multiparty will not touch your hard drive.** But if you add this\nlistener, multiparty automatically sets `form.autoFiles` to `true` and will\nstream uploads to disk for you. \n\n * `name` - the field name for this file\n * `file` - an object with these properties:\n   - `originalFilename` - the filename that the user reports for the file\n   - `path` - the absolute path of the uploaded file on disk\n   - `headers` - the HTTP headers that were sent along with this file\n   - `size` - size of the file in bytes\n\nIf you set the `form.hash` option, then `file` will also contain a `hash`\nproperty which is the checksum of the file.\n\n#### 'field' (name, value)\n\n * `name` - field name\n * `value` - string field value\n\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/superjoe30/node-multiparty/issues"
  },
  "_id": "multiparty@2.1.8",
  "dist": {
    "shasum": "25946d5f81f720b7c40574578e8a3c87e41a95e2"
  },
  "_from": "multiparty@2.1.8",
  "_resolved": "https://registry.npmjs.org/multiparty/-/multiparty-2.1.8.tgz"
}
