How to use the formidable/lib/incoming_form.IncomingForm function in formidable

To help you get started, we’ve selected a few formidable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github persvr / pintura / media / multipart-form-data.js View on Github external
Node(function(request){
		    	form.parse(request, function(err, fields, files) {
		    		var incomingObject = {};
		    		if(err){
		    			return deferred.reject(err);
		    		}
		    		for(var i in files){
		    			fields[i] = files[i];
		    		}
		    		deferred.resolve(fields);
		    	});
			})(request);
			return deferred.promise;
		};
	})(
	require("formidable/lib/incoming_form").IncomingForm, 
	require("jsgi-node/jsgi/node").Node);
	

module.exports = Media({
	mediaType:"multipart/form-data",
	getQuality: function(object){
		return 0.2;
	},
	serialize: function(object, parameters, request){
		var boundary = Math.random().toString().substring(2);
		return {
			forEach:function(write){
				for(var i in object){
					if(object.hasOwnProperty(i)){
						write("--" + boundary + '\n');
						write("Content-Disposition: form-data; name=" + i + "\n\n" + object[i] + '\n');

formidable

A node.js module for parsing form data, especially file uploads.

MIT
Latest version published 21 days ago

Package Health Score

94 / 100
Full package analysis