Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ee-formdata-reader

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ee-formdata-reader

reads formdata from requests

  • 0.1.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

ee-formdata-reader

simple but powerful formdata parser. parses mutipart & urlencoded data from request. caches files in memory or on the disk.

installation

npm install ee-formdata-reader

build status

Build Status

usage

// reader with defaults
var reader = new FormdataReader(request);

// reader with custom limits. all limits are optional
var reader = new FormdataReader({
	  request: request
	, maxLength: 1000 * 1000 * 10 		// 10mb, defaults to 128mb
	, maxFormdataLength: 10000 			// 10k for non file form fields, defaults to 2 mb
	, maxFileLength: 1000 * 1000 * 2 	// 2mb, defaults to 128mb
	, cachePath: '/tmp' 				// store files on the fs instead in memory, defaults to memory
	, cacheId: 'some machine id' 		// if files are stored on the filesystem they will contain a 
										// machine identifier in their filename so one can use shared
										// storage solutions between mutliple machines. defaults to 
										// an identifier provided by the «ee-machine-id» package
});

// when the request has ended and all data has been received, decoded and cached
// the reader will emit an «end» event
reader.on('end', function(){
	// you may retreive the formdata using the «getForm» method
	log(reader.getForm());
});

example

var reader = new FormdataReader(request);

reader.on('end', function(){
	log(reader.getForm());
	// name: 'Michael'
	// files: [
	//    {
	//        data: 2e 2e 2e 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 66 69 6c 65 31 2e 74 78 74 20 2e 2e 2e 
	//        , filename: "file1.txt"
	//    }
	//    , {
	//        data: 2e 2e 2e 63 6f 6e 74 65 6e 74 73 20 6f 66 20 66 69 6c 65 32 2e 67 69 66 2e 2e 2e 
	//        , filename: "file2.gif"
	//    }
	// ]
});

Keywords

FAQs

Package last updated on 28 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc