{
  "_from": "express-fileupload",
  "_id": "express-fileupload@0.4.0",
  "_inBundle": false,
  "_integrity": "sha512-jPv3aCdTIdQrGAUXQ1e1hU0Vnl+0jE9IbzEsI7VRIevQybrUrIMUgvwNwBThnsetandW8+9ICgflAkhKwLUuLw==",
  "_location": "/express-fileupload",
  "_phantomChildren": {},
  "_requested": {
    "escapedName": "express-fileupload",
    "fetchSpec": "latest",
    "name": "express-fileupload",
    "raw": "express-fileupload",
    "rawSpec": "",
    "registry": true,
    "saveSpec": null,
    "type": "tag"
  },
  "_requiredBy": [
    "#USER",
    "/"
  ],
  "_resolved": "https://registry.npmjs.org/express-fileupload/-/express-fileupload-0.4.0.tgz",
  "_shasum": "de6d1dbe3122732c416f6965aa88bbf70721ad84",
  "_spec": "express-fileupload",
  "_where": "/home/ambuj/Desktop/mysql Projects/mobileapp",
  "author": {
    "email": "richardgirges@gmail.com",
    "name": "Richard Girges"
  },
  "bugs": {
    "url": "https://github.com/richardgirges/express-fileupload/issues"
  },
  "bundleDependencies": false,
  "dependencies": {
    "busboy": "^0.2.14",
    "fs-extra": "^4.0.1",
    "md5": "^2.2.1",
    "streamifier": "^0.1.1"
  },
  "deprecated": false,
  "description": "Simple express file upload middleware that wraps around Busboy",
  "devDependencies": {
    "body-parser": "^1.17.2",
    "coveralls": "^2.13.1",
    "eslint": "^4.5.0",
    "eslint-config-google": "^0.9.1",
    "express": "^4.15.4",
    "istanbul": "^0.4.5",
    "mocha": "^3.5.0",
    "supertest": "^3.0.0"
  },
  "engines": {
    "node": ">=4.0.0"
  },
  "homepage": "https://github.com/richardgirges/express-fileupload#readme",
  "keywords": [
    "busboy",
    "express",
    "file-upload",
    "files",
    "forms",
    "middleware",
    "multipart",
    "upload"
  ],
  "license": "MIT",
  "main": "./lib/index",
  "name": "express-fileupload",
  "optionalDependencies": {},
  "readme": "# express-fileupload\nSimple express middleware for uploading files.\n\n[![npm](https://img.shields.io/npm/v/express-fileupload.svg)](https://www.npmjs.org/package/express-fileupload)\n[![Build Status](https://travis-ci.org/richardgirges/express-fileupload.svg?branch=master)](https://travis-ci.org/richardgirges/express-fileupload)\n[![downloads per month](http://img.shields.io/npm/dm/express-fileupload.svg)](https://www.npmjs.org/package/express-fileupload)\n[![Coverage Status](https://img.shields.io/coveralls/richardgirges/express-fileupload.svg)](https://coveralls.io/r/richardgirges/express-fileupload)\n\n# Version 0.2.0 Breaking Changes\n\n#### &raquo; Promise support for `.mv()`\n`.mv()` now returns a Promise when `callback` argument is not provided\n\n#### &raquo; No more support for < Node.js v6\nNo more support for versions of Node older than v6. Use with lower versions of Node at your own risk!\n\n# Install\n```bash\n# With NPM\nnpm install --save express-fileupload\n\n# With Yarn\nyarn add express-fileupload\n```\n\n# Usage\nWhen you upload a file, the file will be accessible from `req.files`.\n\n### Example Scenario\n* You're uploading a file called **car.jpg**\n* Your input's name field is **foo**: `<input name=\"foo\" type=\"file\" />`\n* In your express server request, you can access your uploaded file from `req.files.foo`:\n```javascript\napp.post('/upload', function(req, res) {\n  console.log(req.files.foo); // the uploaded file object\n});\n```\nThe **req.files.foo** object will contain the following:\n* `req.files.foo.name`: \"car.jpg\"\n* `req.files.foo.mv`: A function to move the file elsewhere on your server\n* `req.files.foo.mimetype`: The mimetype of your file\n* `req.files.foo.data`: A buffer representation of your file\n* `req.files.foo.truncated`: A boolean that represents if the file is over the size limit\n\n### Full Example\n**Your node.js code:**\n```javascript\nconst express = require('express');\nconst fileUpload = require('express-fileupload');\nconst app = express();\n\n// default options\napp.use(fileUpload());\n\napp.post('/upload', function(req, res) {\n  if (!req.files)\n    return res.status(400).send('No files were uploaded.');\n\n  // The name of the input field (i.e. \"sampleFile\") is used to retrieve the uploaded file\n  let sampleFile = req.files.sampleFile;\n\n  // Use the mv() method to place the file somewhere on your server\n  sampleFile.mv('/somewhere/on/your/server/filename.jpg', function(err) {\n    if (err)\n      return res.status(500).send(err);\n\n    res.send('File uploaded!');\n  });\n});\n```\n\n**Your HTML file upload form:**\n```html\n<html>\n  <body>\n    <form ref='uploadForm' \n      id='uploadForm' \n      action='http://localhost:8000/upload' \n      method='post' \n      encType=\"multipart/form-data\">\n        <input type=\"file\" name=\"sampleFile\" />\n        <input type='submit' value='Upload!' />\n    </form>     \n  </body>\n</html>\n```\n\n### Uploading Multiple Files\nexpress-fileupload supports multiple file uploads at the same time.\n\nLet's say you have three files in your form, each of the inputs with the name `my_profile_pic`, `my_pet`, and `my_cover_photo`:\n```html\n<input type=\"file\" name=\"my_profile_pic\" />\n<input type=\"file\" name=\"my_pet\" />\n<input type=\"file\" name=\"my_cover_photo\" />\n```\n\nThese uploaded files would be accessible like so:\n```javascript\napp.post('/upload', function(req, res) {\n  // Uploaded files:\n  console.log(req.files.my_profile_pic.name);\n  console.log(req.files.my_pet.name);\n  console.log(req.files.my_cover_photo.name);\n});\n```\n\n### Using Busboy Options\nPass in Busboy options directly to the express-fileupload middleware. [Check out the Busboy documentation here.](https://github.com/mscdex/busboy#api)\n\n```javascript\napp.use(fileUpload({\n  limits: { fileSize: 50 * 1024 * 1024 },\n}));\n```\n\n### Available Options\nPass in non-Busboy options directly to the middleware. These are express-fileupload specific options.\n\nOption | Acceptable&nbsp;Values | Details\n--- | --- | ---\nsafeFileNames | <ul><li><code>false</code>&nbsp;**(default)**</li><li><code>true</code></li><li>regex</li></ul> | Strips characters from the upload's filename. You can use custom regex to determine what to strip. If set to `true`, non-alphanumeric characters _except_ dashes and underscores will be stripped. This option is off by default.<br /><br />**Example #1 (strip slashes from file names):** `app.use(fileUpload({ safeFileNames: /\\\\/g }))`<br />**Example #2:** `app.use(fileUpload({ safeFileNames: true }))`\npreserveExtension | <ul><li><code>false</code>&nbsp;**(default)**</li><li><code>true</code></li><li><code>*Number*</code></li></ul> | Preserves filename extension when using <code>safeFileNames</code> option. If set to <code>true</code>, will default to an extension length of 3. If set to <code>*Number*</code>, this will be the max allowable extension length. If an extension is smaller than the extension length, it remains untouched. If the extension is longer, it is shifted.<br /><br />**Example #1 (true):**<br /><code>app.use(fileUpload({ safeFileNames: true, preserveExtension: true }));</code><br />*myFileName.ext* --> *myFileName.ext*<br /><br />**Example #2 (max extension length 2, extension shifted):**<br /><code>app.use(fileUpload({ safeFileNames: true, preserveExtension: 2 }));</code><br />*myFileName.ext* --> *myFileNamee.xt*\nabortOnLimit | <ul><li><code>false</code>&nbsp;**(default)**</li><li><code>true</code></ul> | Returns a HTTP 413 when the file is bigger than the size limit if true. Otherwise, it will add a <code>truncate = true</code> to the resulting file structure.\n\n# Help Wanted\nPull Requests are welcomed!\n\n# Thanks & Credit\n[Brian White](https://github.com/mscdex) for his stellar work on the [Busboy Package](https://github.com/mscdex/busboy) and the [connect-busboy Package](https://github.com/mscdex/connect-busboy)\n",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/richardgirges/express-fileupload.git"
  },
  "scripts": {
    "coveralls": "cat ./coverage/lcov.info | coveralls",
    "lint": "eslint ./",
    "test": "istanbul cover _mocha -- -R spec"
  },
  "version": "0.4.0"
}
