Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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');