File: chat-websocket/node_modules/express/node_modules/connect/node_modules/formidable/package.json

Recommend this page to a friend!
  Classes of Igor Escobar  >  Terminal Crossword  >  chat-websocket/node_modules/express/node_modules/connect/node_modules/formidable/package.json  >  Download  
File: chat-websocket/node_modules/express/node_modules/connect/node_modules/formidable/package.json
Role: Example script
Content type: text/plain
Description: Example script
Class: Terminal Crossword
Generate a crosswords board on a text console
Author: By
Last change:
Date: 5 months ago
Size: 11,693 bytes


Class file image Download
  "name": "formidable",
  "version": "1.0.11",
  "dependencies": {},
  "devDependencies": {
    "gently": "0.8.0",
    "findit": "0.1.1",
    "hashish": "0.0.4",
    "urun": "0.0.4",
    "utest": "0.0.3"
  "directories": {
    "lib": "./lib"
  "main": "./lib/index",
  "scripts": {
    "test": "make test"
  "engines": {
    "node": "*"
  "optionalDependencies": {},
  "readme": "# Formidable\n\n[![Build Status](](\n\n## Purpose\n\nA node.js module for parsing form data, especially file uploads.\n\n## Current status\n\nThis module was developed for [Transloadit](, a service focused on uploading\nand encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from\na large variety of clients and is considered production-ready.\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## Changelog\n\n### v1.0.9\n\n* Emit progress when content length header parsed (Tim Kosch├╝tzki)\n* Fix Readme syntax due to GitHub changes (goob)\n* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara)\n\n### v1.0.8\n\n* Strip potentially unsafe characters when using `keepExtensions: true`.\n* Switch to utest / urun for testing\n* Add travis build\n\n### v1.0.7\n\n* Remove file from package that was causing problems when installing on windows. (#102)\n* Fix typos in Readme (Jason Davies).\n\n### v1.0.6\n\n* Do not default to the default to the field name for file uploads where\n  filename=\"\".\n\n### v1.0.5\n\n* Support filename=\"\" in multipart parts\n* Explain unexpected end() errors in parser better\n\n**Note:** Starting with this version, formidable emits 'file' events for empty\nfile input fields. Previously those were incorrectly emitted as regular file\ninput fields with value = \"\".\n\n### v1.0.4\n\n* Detect a good default tmp directory regardless of platform. (#88)\n\n### v1.0.3\n\n* Fix problems with utf8 characters (#84) / semicolons in filenames (#58)\n* Small performance improvements\n* New test suite and fixture system\n\n### v1.0.2\n\n* Exclude node\\_modules folder from git\n* Implement new `'aborted'` event\n* Fix files in example folder to work with recent node versions\n* Make gently a devDependency\n\n[See Commits](\n\n### v1.0.1\n\n* Fix package.json to refer to proper main directory. (#68, Dean Landolt)\n\n[See Commits](\n\n### v1.0.0\n\n* Add support for multipart boundaries that are quoted strings. (Jeff Craig)\n\nThis marks the beginning of development on version 2.0 which will include\nseveral architectural improvements.\n\n[See Commits](\n\n### v0.9.11\n\n* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Kosch├╝tzki)\n* Use [W3C FileAPI Draft]( properties for File class\n\n**Important:** The old property names of the File class will be removed in a\nfuture release.\n\n[See Commits](\n\n### Older releases\n\nThese releases were done before starting to maintain the above Changelog:\n\n* [v0.9.10](\n* [v0.9.9](\n* [v0.9.8](\n* [v0.9.7](\n* [v0.9.6](\n* [v0.9.5](\n* [v0.9.4](\n* [v0.9.3](\n* [v0.9.2](\n* [v0.9.1](\n* [v0.9.0](\n* [v0.9.0](\n* [v0.9.0](\n* [v0.9.0](\n* [v0.9.0](\n* [v0.9.0](\n* [v0.9.0](\n* [v0.9.0](\n* [v0.1.0](\n\n## Installation\n\nVia [npm](\n\n    npm install formidable@latest\n\nManually:\n\n    git clone git:// formidable\n    vim my.js\n    # var formidable = require('./formidable');\n\nNote: Formidable requires [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\n    var formidable = require('formidable'),\n        http = require('http'),\n\n        util = require('util');\n\n    http.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        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        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(80);\n\n## API\n\n### formidable.IncomingForm\n\n__new formidable.IncomingForm()__\n\nCreates a new incoming form.\n\n__incomingForm.encoding = 'utf-8'__\n\nThe encoding to use for incoming form fields.\n\n__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__\n\nThe directory for placing file uploads in. You can move them later on using\n`fs.rename()`. The default directory is picked at module load time depending on\nthe first existing directory from those listed above.\n\n__incomingForm.keepExtensions = false__\n\nIf you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`.\n\n__incomingForm.type__\n\nEither 'multipart' or 'urlencoded' depending on the incoming request.\n\n__incomingForm.maxFieldsSize = 2 * 1024 * 1024__\n\nLimits the amount of memory a field (not file) can allocate in bytes.\nIf this value is exceeded, an `'error'` event is emitted. The default\nsize is 2MB.\n\n__incomingForm.hash = false__\n\nIf you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`.\n\n__incomingForm.bytesReceived__\n\nThe amount of bytes received for this form so far.\n\n__incomingForm.bytesExpected__\n\nThe expected number of bytes in this form.\n\n__incomingForm.parse(request, [cb])__\n\nParses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback:\n\n    incomingForm.parse(req, function(err, fields, files) {\n      // ...\n    });\n\n__incomingForm.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    incomingForm.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\n    incomingForm.onPart = function(part) {\n      if (!part.filename) {\n        // let formidable handle all non-file parts\n        incomingForm.handlePart(part);\n      }\n    }\n\nCheck the code in this method for further inspiration.\n\n__Event: 'progress' (bytesReceived, bytesExpected)__\n\nEmitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar.\n\n__Event: 'field' (name, value)__\n\nEmitted whenever a field / value pair has been received.\n\n__Event: 'fileBegin' (name, file)__\n\nEmitted whenever a new file is detected in the upload stream. Use this even if\nyou want to stream the file to somewhere else while buffering the upload on\nthe file system.\n\n__Event: 'file' (name, file)__\n\nEmitted whenever a field / file pair has been received. `file` is an instance of `File`.\n\n__Event: 'error' (err)__\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__Event: 'aborted'__\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. In the future there will be a separate 'timeout' event (needs a change in the node core).\n\n__Event: 'end' ()__\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### formidable.File\n\n__file.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\n__file.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\ = null__\n\nThe name this file had according to the uploading client.\n\n__file.type = null__\n\nThe mime type of this file, according to the uploading client.\n\n__file.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](\n\n__file.hash = null__\n\nIf hash calculation was set, you can read the hex digest out of this var.\n\n## License\n\nFormidable is licensed under the MIT license.\n\n## Ports\n\n* [multipart-parser]( a C++ parser based on formidable\n\n## Credits\n\n* [Ryan Dahl]( for his work on [http-parser]( which heavily inspired multipart_parser.js\n",
  "readmeFilename": "",
  "_id": "formidable@1.0.11",
  "description": "[![Build Status](](",
  "dist": {
    "shasum": "c3b2df776096f2bfb089116910c4da44f561b21c"
  "_from": "formidable@1.0.11"