You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by da...@apache.org on 2015/11/30 22:06:37 UTC
[31/98] [abbrv] [partial] incubator-apex-malhar git commit: Removing
all web demos
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/json.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/json.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/json.js
deleted file mode 100644
index eb8a724..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/json.js
+++ /dev/null
@@ -1,67 +0,0 @@
-var common = require('../test/common'),
- http = require('http'),
- util = require('util'),
- formidable = common.formidable,
- Buffer = require('buffer').Buffer,
- port = common.port,
- server;
-
-server = http.createServer(function(req, res) {
- if (req.method !== 'POST') {
- res.writeHead(200, {'content-type': 'text/plain'})
- res.end('Please POST a JSON payload to http://localhost:'+port+'/')
- return;
- }
-
- var form = new formidable.IncomingForm(),
- fields = {};
-
- form
- .on('error', function(err) {
- res.writeHead(500, {'content-type': 'text/plain'});
- res.end('error:\n\n'+util.inspect(err));
- console.error(err);
- })
- .on('field', function(field, value) {
- console.log(field, value);
- fields[field] = value;
- })
- .on('end', function() {
- console.log('-> post done');
- res.writeHead(200, {'content-type': 'text/plain'});
- res.end('received fields:\n\n '+util.inspect(fields));
- });
- form.parse(req);
-});
-server.listen(port);
-
-console.log('listening on http://localhost:'+port+'/');
-
-
-var request = http.request({
- host: 'localhost',
- path: '/',
- port: port,
- method: 'POST',
- headers: { 'content-type':'application/json', 'content-length':48 }
-}, function(response) {
- var data = '';
- console.log('\nServer responded with:');
- console.log('Status:', response.statusCode);
- response.pipe(process.stdout);
- response.on('end', function() {
- console.log('\n')
- process.exit();
- });
- // response.on('data', function(chunk) {
- // data += chunk.toString('utf8');
- // });
- // response.on('end', function() {
- // console.log('Response Data:')
- // console.log(data);
- // process.exit();
- // });
-})
-
-request.write('{"numbers":[1,2,3,4,5],"nested":{"key":"value"}}');
-request.end();
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js
deleted file mode 100644
index f6c15a6..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js
+++ /dev/null
@@ -1,43 +0,0 @@
-require('../test/common');
-var http = require('http'),
- util = require('util'),
- formidable = require('formidable'),
- server;
-
-server = http.createServer(function(req, res) {
- if (req.url == '/') {
- res.writeHead(200, {'content-type': 'text/html'});
- res.end(
- '<form action="/post" method="post">'+
- '<input type="text" name="title"><br>'+
- '<input type="text" name="data[foo][]"><br>'+
- '<input type="submit" value="Submit">'+
- '</form>'
- );
- } else if (req.url == '/post') {
- var form = new formidable.IncomingForm(),
- fields = [];
-
- form
- .on('error', function(err) {
- res.writeHead(200, {'content-type': 'text/plain'});
- res.end('error:\n\n'+util.inspect(err));
- })
- .on('field', function(field, value) {
- console.log(field, value);
- fields.push([field, value]);
- })
- .on('end', function() {
- console.log('-> post done');
- res.writeHead(200, {'content-type': 'text/plain'});
- res.end('received fields:\n\n '+util.inspect(fields));
- });
- form.parse(req);
- } else {
- res.writeHead(404, {'content-type': 'text/plain'});
- res.end('404');
- }
-});
-server.listen(TEST_PORT);
-
-console.log('listening on http://localhost:'+TEST_PORT+'/');
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js
deleted file mode 100644
index 050cdd9..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js
+++ /dev/null
@@ -1,48 +0,0 @@
-require('../test/common');
-var http = require('http'),
- util = require('util'),
- formidable = require('formidable'),
- server;
-
-server = http.createServer(function(req, res) {
- if (req.url == '/') {
- res.writeHead(200, {'content-type': 'text/html'});
- res.end(
- '<form action="/upload" enctype="multipart/form-data" method="post">'+
- '<input type="text" name="title"><br>'+
- '<input type="file" name="upload" multiple="multiple"><br>'+
- '<input type="submit" value="Upload">'+
- '</form>'
- );
- } else if (req.url == '/upload') {
- var form = new formidable.IncomingForm(),
- files = [],
- fields = [];
-
- form.uploadDir = TEST_TMP;
-
- form
- .on('field', function(field, value) {
- console.log(field, value);
- fields.push([field, value]);
- })
- .on('file', function(field, file) {
- console.log(field, file);
- files.push([field, file]);
- })
- .on('end', function() {
- console.log('-> upload done');
- res.writeHead(200, {'content-type': 'text/plain'});
- res.write('received fields:\n\n '+util.inspect(fields));
- res.write('\n\n');
- res.end('received files:\n\n '+util.inspect(files));
- });
- form.parse(req);
- } else {
- res.writeHead(404, {'content-type': 'text/plain'});
- res.end('404');
- }
-});
-server.listen(TEST_PORT);
-
-console.log('listening on http://localhost:'+TEST_PORT+'/');
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/index.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/index.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/index.js
deleted file mode 100644
index 4cc88b3..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('./lib');
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js
deleted file mode 100644
index e34c10e..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js
+++ /dev/null
@@ -1,72 +0,0 @@
-if (global.GENTLY) require = GENTLY.hijack(require);
-
-var util = require('util'),
- WriteStream = require('fs').WriteStream,
- EventEmitter = require('events').EventEmitter,
- crypto = require('crypto');
-
-function File(properties) {
- EventEmitter.call(this);
-
- this.size = 0;
- this.path = null;
- this.name = null;
- this.type = null;
- this.hash = null;
- this.lastModifiedDate = null;
-
- this._writeStream = null;
-
- for (var key in properties) {
- this[key] = properties[key];
- }
-
- if(typeof this.hash === 'string') {
- this.hash = crypto.createHash(properties.hash);
- } else {
- this.hash = null;
- }
-}
-module.exports = File;
-util.inherits(File, EventEmitter);
-
-File.prototype.open = function() {
- this._writeStream = new WriteStream(this.path);
-};
-
-File.prototype.toJSON = function() {
- return {
- size: this.size,
- path: this.path,
- name: this.name,
- type: this.type,
- mtime: this.lastModifiedDate,
- length: this.length,
- filename: this.filename,
- mime: this.mime
- };
-};
-
-File.prototype.write = function(buffer, cb) {
- var self = this;
- if (self.hash) {
- self.hash.update(buffer);
- }
- this._writeStream.write(buffer, function() {
- self.lastModifiedDate = new Date();
- self.size += buffer.length;
- self.emit('progress', self.size);
- cb();
- });
-};
-
-File.prototype.end = function(cb) {
- var self = this;
- if (self.hash) {
- self.hash = self.hash.digest('hex');
- }
- this._writeStream.end(function() {
- self.emit('end');
- cb();
- });
-};
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js
deleted file mode 100644
index c2eeaf8..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js
+++ /dev/null
@@ -1,535 +0,0 @@
-if (global.GENTLY) require = GENTLY.hijack(require);
-
-var fs = require('fs');
-var util = require('util'),
- path = require('path'),
- File = require('./file'),
- MultipartParser = require('./multipart_parser').MultipartParser,
- QuerystringParser = require('./querystring_parser').QuerystringParser,
- OctetParser = require('./octet_parser').OctetParser,
- JSONParser = require('./json_parser').JSONParser,
- StringDecoder = require('string_decoder').StringDecoder,
- EventEmitter = require('events').EventEmitter,
- Stream = require('stream').Stream,
- os = require('os');
-
-function IncomingForm(opts) {
- if (!(this instanceof IncomingForm)) return new IncomingForm(opts);
- EventEmitter.call(this);
-
- opts=opts||{};
-
- this.error = null;
- this.ended = false;
-
- this.maxFields = opts.maxFields || 1000;
- this.maxFieldsSize = opts.maxFieldsSize || 2 * 1024 * 1024;
- this.keepExtensions = opts.keepExtensions || false;
- this.uploadDir = opts.uploadDir || os.tmpDir();
- this.encoding = opts.encoding || 'utf-8';
- this.headers = null;
- this.type = null;
- this.hash = false;
-
- this.bytesReceived = null;
- this.bytesExpected = null;
-
- this._parser = null;
- this._flushing = 0;
- this._fieldsSize = 0;
- this.openedFiles = [];
-
- return this;
-};
-util.inherits(IncomingForm, EventEmitter);
-exports.IncomingForm = IncomingForm;
-
-IncomingForm.prototype.parse = function(req, cb) {
- this.pause = function() {
- try {
- req.pause();
- } catch (err) {
- // the stream was destroyed
- if (!this.ended) {
- // before it was completed, crash & burn
- this._error(err);
- }
- return false;
- }
- return true;
- };
-
- this.resume = function() {
- try {
- req.resume();
- } catch (err) {
- // the stream was destroyed
- if (!this.ended) {
- // before it was completed, crash & burn
- this._error(err);
- }
- return false;
- }
-
- return true;
- };
-
- // Setup callback first, so we don't miss anything from data events emitted
- // immediately.
- if (cb) {
- var fields = {}, files = {};
- this
- .on('field', function(name, value) {
- fields[name] = value;
- })
- .on('file', function(name, file) {
- files[name] = file;
- })
- .on('error', function(err) {
- cb(err, fields, files);
- })
- .on('end', function() {
- cb(null, fields, files);
- });
- }
-
- // Parse headers and setup the parser, ready to start listening for data.
- this.writeHeaders(req.headers);
-
- // Start listening for data.
- var self = this;
- req
- .on('error', function(err) {
- self._error(err);
- })
- .on('aborted', function() {
- self.emit('aborted');
- self._error(new Error('Request aborted'));
- })
- .on('data', function(buffer) {
- self.write(buffer);
- })
- .on('end', function() {
- if (self.error) {
- return;
- }
-
- var err = self._parser.end();
- if (err) {
- self._error(err);
- }
- });
-
- return this;
-};
-
-IncomingForm.prototype.writeHeaders = function(headers) {
- this.headers = headers;
- this._parseContentLength();
- this._parseContentType();
-};
-
-IncomingForm.prototype.write = function(buffer) {
- if (!this._parser) {
- this._error(new Error('unintialized parser'));
- return;
- }
-
- this.bytesReceived += buffer.length;
- this.emit('progress', this.bytesReceived, this.bytesExpected);
-
- var bytesParsed = this._parser.write(buffer);
- if (bytesParsed !== buffer.length) {
- this._error(new Error('parser error, '+bytesParsed+' of '+buffer.length+' bytes parsed'));
- }
-
- return bytesParsed;
-};
-
-IncomingForm.prototype.pause = function() {
- // this does nothing, unless overwritten in IncomingForm.parse
- return false;
-};
-
-IncomingForm.prototype.resume = function() {
- // this does nothing, unless overwritten in IncomingForm.parse
- return false;
-};
-
-IncomingForm.prototype.onPart = function(part) {
- // this method can be overwritten by the user
- this.handlePart(part);
-};
-
-IncomingForm.prototype.handlePart = function(part) {
- var self = this;
-
- if (part.filename === undefined) {
- var value = ''
- , decoder = new StringDecoder(this.encoding);
-
- part.on('data', function(buffer) {
- self._fieldsSize += buffer.length;
- if (self._fieldsSize > self.maxFieldsSize) {
- self._error(new Error('maxFieldsSize exceeded, received '+self._fieldsSize+' bytes of field data'));
- return;
- }
- value += decoder.write(buffer);
- });
-
- part.on('end', function() {
- self.emit('field', part.name, value);
- });
- return;
- }
-
- this._flushing++;
-
- var file = new File({
- path: this._uploadPath(part.filename),
- name: part.filename,
- type: part.mime,
- hash: self.hash
- });
-
- this.emit('fileBegin', part.name, file);
-
- file.open();
- this.openedFiles.push(file);
-
- part.on('data', function(buffer) {
- self.pause();
- file.write(buffer, function() {
- self.resume();
- });
- });
-
- part.on('end', function() {
- file.end(function() {
- self._flushing--;
- self.emit('file', part.name, file);
- self._maybeEnd();
- });
- });
-};
-
-function dummyParser(self) {
- return {
- end: function () {
- self.ended = true;
- self._maybeEnd();
- return null;
- }
- };
-}
-
-IncomingForm.prototype._parseContentType = function() {
- if (this.bytesExpected === 0) {
- this._parser = dummyParser(this);
- return;
- }
-
- if (!this.headers['content-type']) {
- this._error(new Error('bad content-type header, no content-type'));
- return;
- }
-
- if (this.headers['content-type'].match(/octet-stream/i)) {
- this._initOctetStream();
- return;
- }
-
- if (this.headers['content-type'].match(/urlencoded/i)) {
- this._initUrlencoded();
- return;
- }
-
- if (this.headers['content-type'].match(/multipart/i)) {
- var m;
- if (m = this.headers['content-type'].match(/boundary=(?:"([^"]+)"|([^;]+))/i)) {
- this._initMultipart(m[1] || m[2]);
- } else {
- this._error(new Error('bad content-type header, no multipart boundary'));
- }
- return;
- }
-
- if (this.headers['content-type'].match(/json/i)) {
- this._initJSONencoded();
- return;
- }
-
- this._error(new Error('bad content-type header, unknown content-type: '+this.headers['content-type']));
-};
-
-IncomingForm.prototype._error = function(err) {
- if (this.error || this.ended) {
- return;
- }
-
- this.error = err;
- this.pause();
- this.emit('error', err);
-
- if (Array.isArray(this.openedFiles)) {
- this.openedFiles.forEach(function(file) {
- file._writeStream.destroy();
- setTimeout(fs.unlink, 0, file.path);
- });
- }
-};
-
-IncomingForm.prototype._parseContentLength = function() {
- this.bytesReceived = 0;
- if (this.headers['content-length']) {
- this.bytesExpected = parseInt(this.headers['content-length'], 10);
- } else if (this.headers['transfer-encoding'] === undefined) {
- this.bytesExpected = 0;
- }
-
- if (this.bytesExpected !== null) {
- this.emit('progress', this.bytesReceived, this.bytesExpected);
- }
-};
-
-IncomingForm.prototype._newParser = function() {
- return new MultipartParser();
-};
-
-IncomingForm.prototype._initMultipart = function(boundary) {
- this.type = 'multipart';
-
- var parser = new MultipartParser(),
- self = this,
- headerField,
- headerValue,
- part;
-
- parser.initWithBoundary(boundary);
-
- parser.onPartBegin = function() {
- part = new Stream();
- part.readable = true;
- part.headers = {};
- part.name = null;
- part.filename = null;
- part.mime = null;
-
- part.transferEncoding = 'binary';
- part.transferBuffer = '';
-
- headerField = '';
- headerValue = '';
- };
-
- parser.onHeaderField = function(b, start, end) {
- headerField += b.toString(self.encoding, start, end);
- };
-
- parser.onHeaderValue = function(b, start, end) {
- headerValue += b.toString(self.encoding, start, end);
- };
-
- parser.onHeaderEnd = function() {
- headerField = headerField.toLowerCase();
- part.headers[headerField] = headerValue;
-
- var m;
- if (headerField == 'content-disposition') {
- if (m = headerValue.match(/\bname="([^"]+)"/i)) {
- part.name = m[1];
- }
-
- part.filename = self._fileName(headerValue);
- } else if (headerField == 'content-type') {
- part.mime = headerValue;
- } else if (headerField == 'content-transfer-encoding') {
- part.transferEncoding = headerValue.toLowerCase();
- }
-
- headerField = '';
- headerValue = '';
- };
-
- parser.onHeadersEnd = function() {
- switch(part.transferEncoding){
- case 'binary':
- case '7bit':
- case '8bit':
- parser.onPartData = function(b, start, end) {
- part.emit('data', b.slice(start, end));
- };
-
- parser.onPartEnd = function() {
- part.emit('end');
- };
- break;
-
- case 'base64':
- parser.onPartData = function(b, start, end) {
- part.transferBuffer += b.slice(start, end).toString('ascii');
-
- /*
- four bytes (chars) in base64 converts to three bytes in binary
- encoding. So we should always work with a number of bytes that
- can be divided by 4, it will result in a number of buytes that
- can be divided vy 3.
- */
- var offset = parseInt(part.transferBuffer.length / 4) * 4;
- part.emit('data', new Buffer(part.transferBuffer.substring(0, offset), 'base64'))
- part.transferBuffer = part.transferBuffer.substring(offset);
- };
-
- parser.onPartEnd = function() {
- part.emit('data', new Buffer(part.transferBuffer, 'base64'))
- part.emit('end');
- };
- break;
-
- default:
- return self._error(new Error('unknown transfer-encoding'));
- }
-
- self.onPart(part);
- };
-
-
- parser.onEnd = function() {
- self.ended = true;
- self._maybeEnd();
- };
-
- this._parser = parser;
-};
-
-IncomingForm.prototype._fileName = function(headerValue) {
- var m = headerValue.match(/\bfilename="(.*?)"($|; )/i);
- if (!m) return;
-
- var filename = m[1].substr(m[1].lastIndexOf('\\') + 1);
- filename = filename.replace(/%22/g, '"');
- filename = filename.replace(/&#([\d]{4});/g, function(m, code) {
- return String.fromCharCode(code);
- });
- return filename;
-};
-
-IncomingForm.prototype._initUrlencoded = function() {
- this.type = 'urlencoded';
-
- var parser = new QuerystringParser(this.maxFields)
- , self = this;
-
- parser.onField = function(key, val) {
- self.emit('field', key, val);
- };
-
- parser.onEnd = function() {
- self.ended = true;
- self._maybeEnd();
- };
-
- this._parser = parser;
-};
-
-IncomingForm.prototype._initOctetStream = function() {
- this.type = 'octet-stream';
- var filename = this.headers['x-file-name'];
- var mime = this.headers['content-type'];
-
- var file = new File({
- path: this._uploadPath(filename),
- name: filename,
- type: mime
- });
-
- file.open();
-
- this.emit('fileBegin', filename, file);
-
- this._flushing++;
-
- var self = this;
-
- self._parser = new OctetParser();
-
- //Keep track of writes that haven't finished so we don't emit the file before it's done being written
- var outstandingWrites = 0;
-
- self._parser.on('data', function(buffer){
- self.pause();
- outstandingWrites++;
-
- file.write(buffer, function() {
- outstandingWrites--;
- self.resume();
-
- if(self.ended){
- self._parser.emit('doneWritingFile');
- }
- });
- });
-
- self._parser.on('end', function(){
- self._flushing--;
- self.ended = true;
-
- var done = function(){
- self.emit('file', 'file', file);
- self._maybeEnd();
- };
-
- if(outstandingWrites === 0){
- done();
- } else {
- self._parser.once('doneWritingFile', done);
- }
- });
-};
-
-IncomingForm.prototype._initJSONencoded = function() {
- this.type = 'json';
-
- var parser = new JSONParser()
- , self = this;
-
- if (this.bytesExpected) {
- parser.initWithLength(this.bytesExpected);
- }
-
- parser.onField = function(key, val) {
- self.emit('field', key, val);
- }
-
- parser.onEnd = function() {
- self.ended = true;
- self._maybeEnd();
- };
-
- this._parser = parser;
-};
-
-IncomingForm.prototype._uploadPath = function(filename) {
- var name = '';
- for (var i = 0; i < 32; i++) {
- name += Math.floor(Math.random() * 16).toString(16);
- }
-
- if (this.keepExtensions) {
- var ext = path.extname(filename);
- ext = ext.replace(/(\.[a-z0-9]+).*/, '$1');
-
- name += ext;
- }
-
- return path.join(this.uploadDir, name);
-};
-
-IncomingForm.prototype._maybeEnd = function() {
- if (!this.ended || this._flushing || this.error) {
- return;
- }
-
- this.emit('end');
-};
-
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js
deleted file mode 100644
index 7a6e3e1..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-var IncomingForm = require('./incoming_form').IncomingForm;
-IncomingForm.IncomingForm = IncomingForm;
-module.exports = IncomingForm;
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/json_parser.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/json_parser.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/json_parser.js
deleted file mode 100644
index 6ce966b..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/json_parser.js
+++ /dev/null
@@ -1,35 +0,0 @@
-if (global.GENTLY) require = GENTLY.hijack(require);
-
-var Buffer = require('buffer').Buffer
-
-function JSONParser() {
- this.data = new Buffer('');
- this.bytesWritten = 0;
-};
-exports.JSONParser = JSONParser;
-
-JSONParser.prototype.initWithLength = function(length) {
- this.data = new Buffer(length);
-}
-
-JSONParser.prototype.write = function(buffer) {
- if (this.data.length >= this.bytesWritten + buffer.length) {
- buffer.copy(this.data, this.bytesWritten);
- } else {
- this.data = Buffer.concat([this.data, buffer]);
- }
- this.bytesWritten += buffer.length;
- return buffer.length;
-}
-
-JSONParser.prototype.end = function() {
- try {
- var fields = JSON.parse(this.data.toString('utf8'))
- for (var field in fields) {
- this.onField(field, fields[field]);
- }
- } catch (e) {}
- this.data = null;
-
- this.onEnd();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
deleted file mode 100644
index 98a6856..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
+++ /dev/null
@@ -1,324 +0,0 @@
-var Buffer = require('buffer').Buffer,
- s = 0,
- S =
- { PARSER_UNINITIALIZED: s++,
- START: s++,
- START_BOUNDARY: s++,
- HEADER_FIELD_START: s++,
- HEADER_FIELD: s++,
- HEADER_VALUE_START: s++,
- HEADER_VALUE: s++,
- HEADER_VALUE_ALMOST_DONE: s++,
- HEADERS_ALMOST_DONE: s++,
- PART_DATA_START: s++,
- PART_DATA: s++,
- PART_END: s++,
- END: s++
- },
-
- f = 1,
- F =
- { PART_BOUNDARY: f,
- LAST_BOUNDARY: f *= 2
- },
-
- LF = 10,
- CR = 13,
- SPACE = 32,
- HYPHEN = 45,
- COLON = 58,
- A = 97,
- Z = 122,
-
- lower = function(c) {
- return c | 0x20;
- };
-
-for (s in S) {
- exports[s] = S[s];
-}
-
-function MultipartParser() {
- this.boundary = null;
- this.boundaryChars = null;
- this.lookbehind = null;
- this.state = S.PARSER_UNINITIALIZED;
-
- this.index = null;
- this.flags = 0;
-};
-exports.MultipartParser = MultipartParser;
-
-MultipartParser.stateToString = function(stateNumber) {
- for (var state in S) {
- var number = S[state];
- if (number === stateNumber) return state;
- }
-};
-
-MultipartParser.prototype.initWithBoundary = function(str) {
- this.boundary = new Buffer(str.length+4);
- this.boundary.write('\r\n--', 'ascii', 0);
- this.boundary.write(str, 'ascii', 4);
- this.lookbehind = new Buffer(this.boundary.length+8);
- this.state = S.START;
-
- this.boundaryChars = {};
- for (var i = 0; i < this.boundary.length; i++) {
- this.boundaryChars[this.boundary[i]] = true;
- }
-};
-
-MultipartParser.prototype.write = function(buffer) {
- var self = this,
- i = 0,
- len = buffer.length,
- prevIndex = this.index,
- index = this.index,
- state = this.state,
- flags = this.flags,
- lookbehind = this.lookbehind,
- boundary = this.boundary,
- boundaryChars = this.boundaryChars,
- boundaryLength = this.boundary.length,
- boundaryEnd = boundaryLength - 1,
- bufferLength = buffer.length,
- c,
- cl,
-
- mark = function(name) {
- self[name+'Mark'] = i;
- },
- clear = function(name) {
- delete self[name+'Mark'];
- },
- callback = function(name, buffer, start, end) {
- if (start !== undefined && start === end) {
- return;
- }
-
- var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1);
- if (callbackSymbol in self) {
- self[callbackSymbol](buffer, start, end);
- }
- },
- dataCallback = function(name, clear) {
- var markSymbol = name+'Mark';
- if (!(markSymbol in self)) {
- return;
- }
-
- if (!clear) {
- callback(name, buffer, self[markSymbol], buffer.length);
- self[markSymbol] = 0;
- } else {
- callback(name, buffer, self[markSymbol], i);
- delete self[markSymbol];
- }
- };
-
- for (i = 0; i < len; i++) {
- c = buffer[i];
- switch (state) {
- case S.PARSER_UNINITIALIZED:
- return i;
- case S.START:
- index = 0;
- state = S.START_BOUNDARY;
- case S.START_BOUNDARY:
- if (index == boundary.length - 2) {
- if (c != CR) {
- return i;
- }
- index++;
- break;
- } else if (index - 1 == boundary.length - 2) {
- if (c != LF) {
- return i;
- }
- index = 0;
- callback('partBegin');
- state = S.HEADER_FIELD_START;
- break;
- }
-
- if (c != boundary[index+2]) {
- index = -2;
- }
- if (c == boundary[index+2]) {
- index++;
- }
- break;
- case S.HEADER_FIELD_START:
- state = S.HEADER_FIELD;
- mark('headerField');
- index = 0;
- case S.HEADER_FIELD:
- if (c == CR) {
- clear('headerField');
- state = S.HEADERS_ALMOST_DONE;
- break;
- }
-
- index++;
- if (c == HYPHEN) {
- break;
- }
-
- if (c == COLON) {
- if (index == 1) {
- // empty header field
- return i;
- }
- dataCallback('headerField', true);
- state = S.HEADER_VALUE_START;
- break;
- }
-
- cl = lower(c);
- if (cl < A || cl > Z) {
- return i;
- }
- break;
- case S.HEADER_VALUE_START:
- if (c == SPACE) {
- break;
- }
-
- mark('headerValue');
- state = S.HEADER_VALUE;
- case S.HEADER_VALUE:
- if (c == CR) {
- dataCallback('headerValue', true);
- callback('headerEnd');
- state = S.HEADER_VALUE_ALMOST_DONE;
- }
- break;
- case S.HEADER_VALUE_ALMOST_DONE:
- if (c != LF) {
- return i;
- }
- state = S.HEADER_FIELD_START;
- break;
- case S.HEADERS_ALMOST_DONE:
- if (c != LF) {
- return i;
- }
-
- callback('headersEnd');
- state = S.PART_DATA_START;
- break;
- case S.PART_DATA_START:
- state = S.PART_DATA;
- mark('partData');
- case S.PART_DATA:
- prevIndex = index;
-
- if (index == 0) {
- // boyer-moore derrived algorithm to safely skip non-boundary data
- i += boundaryEnd;
- while (i < bufferLength && !(buffer[i] in boundaryChars)) {
- i += boundaryLength;
- }
- i -= boundaryEnd;
- c = buffer[i];
- }
-
- if (index < boundary.length) {
- if (boundary[index] == c) {
- if (index == 0) {
- dataCallback('partData', true);
- }
- index++;
- } else {
- index = 0;
- }
- } else if (index == boundary.length) {
- index++;
- if (c == CR) {
- // CR = part boundary
- flags |= F.PART_BOUNDARY;
- } else if (c == HYPHEN) {
- // HYPHEN = end boundary
- flags |= F.LAST_BOUNDARY;
- } else {
- index = 0;
- }
- } else if (index - 1 == boundary.length) {
- if (flags & F.PART_BOUNDARY) {
- index = 0;
- if (c == LF) {
- // unset the PART_BOUNDARY flag
- flags &= ~F.PART_BOUNDARY;
- callback('partEnd');
- callback('partBegin');
- state = S.HEADER_FIELD_START;
- break;
- }
- } else if (flags & F.LAST_BOUNDARY) {
- if (c == HYPHEN) {
- callback('partEnd');
- callback('end');
- state = S.END;
- } else {
- index = 0;
- }
- } else {
- index = 0;
- }
- }
-
- if (index > 0) {
- // when matching a possible boundary, keep a lookbehind reference
- // in case it turns out to be a false lead
- lookbehind[index-1] = c;
- } else if (prevIndex > 0) {
- // if our boundary turned out to be rubbish, the captured lookbehind
- // belongs to partData
- callback('partData', lookbehind, 0, prevIndex);
- prevIndex = 0;
- mark('partData');
-
- // reconsider the current character even so it interrupted the sequence
- // it could be the beginning of a new sequence
- i--;
- }
-
- break;
- case S.END:
- break;
- default:
- return i;
- }
- }
-
- dataCallback('headerField');
- dataCallback('headerValue');
- dataCallback('partData');
-
- this.index = index;
- this.state = state;
- this.flags = flags;
-
- return len;
-};
-
-MultipartParser.prototype.end = function() {
- var callback = function(self, name) {
- var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1);
- if (callbackSymbol in self) {
- self[callbackSymbol]();
- }
- };
- if ((this.state == S.HEADER_FIELD_START && this.index == 0) ||
- (this.state == S.PART_DATA && this.index == this.boundary.length)) {
- callback(this, 'partEnd');
- callback(this, 'end');
- } else if (this.state != S.END) {
- return new Error('MultipartParser.end(): stream ended unexpectedly: ' + this.explain());
- }
-};
-
-MultipartParser.prototype.explain = function() {
- return 'state = ' + MultipartParser.stateToString(this.state);
-};
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/octet_parser.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/octet_parser.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/octet_parser.js
deleted file mode 100644
index 6e8b551..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/octet_parser.js
+++ /dev/null
@@ -1,20 +0,0 @@
-var EventEmitter = require('events').EventEmitter
- , util = require('util');
-
-function OctetParser(options){
- if(!(this instanceof OctetParser)) return new OctetParser(options);
- EventEmitter.call(this);
-}
-
-util.inherits(OctetParser, EventEmitter);
-
-exports.OctetParser = OctetParser;
-
-OctetParser.prototype.write = function(buffer) {
- this.emit('data', buffer);
- return buffer.length;
-};
-
-OctetParser.prototype.end = function() {
- this.emit('end');
-};
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
deleted file mode 100644
index 320ce5a..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
+++ /dev/null
@@ -1,27 +0,0 @@
-if (global.GENTLY) require = GENTLY.hijack(require);
-
-// This is a buffering parser, not quite as nice as the multipart one.
-// If I find time I'll rewrite this to be fully streaming as well
-var querystring = require('querystring');
-
-function QuerystringParser(maxKeys) {
- this.maxKeys = maxKeys;
- this.buffer = '';
-};
-exports.QuerystringParser = QuerystringParser;
-
-QuerystringParser.prototype.write = function(buffer) {
- this.buffer += buffer.toString('ascii');
- return buffer.length;
-};
-
-QuerystringParser.prototype.end = function() {
- var fields = querystring.parse(this.buffer, '&', '=', { maxKeys: this.maxKeys });
- for (var field in fields) {
- this.onField(field, fields[field]);
- }
- this.buffer = '';
-
- this.onEnd();
-};
-
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/package.json
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/package.json b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/package.json
deleted file mode 100644
index 4679a11..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/package.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "name": "formidable",
- "description": "A node.js module for parsing form data, especially file uploads.",
- "homepage": "https://github.com/felixge/node-formidable",
- "version": "1.0.14",
- "devDependencies": {
- "gently": "0.8.0",
- "findit": "0.1.1",
- "hashish": "0.0.4",
- "urun": "~0.0.6",
- "utest": "0.0.3",
- "request": "~2.11.4"
- },
- "directories": {
- "lib": "./lib"
- },
- "main": "./lib/index",
- "scripts": {
- "test": "node test/run.js",
- "clean": "rm test/tmp/*"
- },
- "engines": {
- "node": ">=0.8.0"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/felixge/node-formidable.git"
- },
- "bugs": {
- "url": "http://github.com/felixge/node-formidable/issues"
- },
- "optionalDependencies": {},
- "readme": "# Formidable\n\n[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable)\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](http://transloadit.com/), 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## Installation\n\nVia [npm](http://github.com/isaacs/npm):\n```\nnpm install formidable@latest\n```\nManually:\n```\ngit clone git://github.com/felixge/node-formidable.git formidable\nvim my.js\n# var formidable = require('./formidable');\n```\n\nNote: Formida
ble requires [gently](http://github.com/felixge/node-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```javascript\nvar formidable = require('formidable'),\n http = require('http'),\n util = require('util');\n\nhttp.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\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\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=\"uplo
ad\" multiple=\"multiple\"><br>'+\n '<input type=\"submit\" value=\"Upload\">'+\n '</form>'\n );\n}).listen(8080);\n```\n## API\n\n### Formidable.IncomingForm\n```javascript\nvar form = new formidable.IncomingForm()\n```\nCreates a new incoming form.\n\n```javascript\nform.encoding = 'utf-8';\n```\nSets encoding for incoming form fields.\n\n```javascript\nform.uploadDir = process.env.TMP || process.env.TMPDIR || process.env.TEMP || '/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```javascript\nform.keepExtensions = false;\n```\nIf you want the files written to `form.uploadDir` to include the extensions of the original files, set this property to `true`.\n\n```javascript\nform.type\n```\nEither 'multipart' or 'urlencoded' depending on the incoming request.\n\n```javascript\nform.max
FieldsSize = 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```javascript\nform.maxFields = 0;\n```\nLimits the number of fields that the querystring parser will decode. Defaults\nto 0 (unlimited).\n\n```javascript\nform.hash = false;\n```\nIf you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`.\n\n```javascript\nform.bytesReceived\n```\nThe amount of bytes received for this form so far.\n\n```javascript\nform.bytesExpected\n```\nThe expected number of bytes in this form.\n\n```javascript\nform.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\n```javascript\nform.parse(req, function(err, fields, files) {\n // ...\n});\n\nform.onPart(part);\n```\nYou may overwrite this method if you are inter
ested 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```javascript\nform.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```javascript\nform.onPart = function(part) {\n if (!part.filename) {\n // let formidable handle all non-file parts\n form.handlePart(part);\n }\n}\n```\nCheck the code in this method for further inspiration.\n\n\n### Formidable.File\n```javascript\nfile.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```javascript\nfile.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```javascript\nfile.name = null\n```\nThe name this file had according to the uploading client.\n```javascript\nfile.type = null\n```\nThe mime type of this file, according to the uploading client.\n```javascript\nfile.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](http://dev.w3.org/2006/webapi/FileAPI/).\n```javascript\nfile.hash = null\n```\nIf hash calculation was set, you can read the hex digest out of this var.\n\n#### Formidable.File#toJSON()\n\n This method returns a JSON-representation of the file, allowing you to\n `JSON.stringify()` the file which is useful for logging and responding\n to requests.\n\n### Events\n\n\n#### 'progress'\n```javascript\nform.on('progress', function(bytesReceived, bytesExpected) {\n});\n```\nEmitted after each incoming chunk of data that ha
s been parsed. Can be used to roll your own progress bar.\n\n\n\n#### 'field'\n```javascript\nform.on('field', function(name, value) {\n});\n```\n\n#### 'fileBegin'\n\nEmitted whenever a field / value pair has been received.\n```javascript\nform.on('fileBegin', function(name, file) {\n});\n```\n\n#### '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\nEmitted whenever a field / file pair has been received. `file` is an instance of `File`.\n```javascript\nform.on('file', function(name, file) {\n});\n```\n\n#### 'error'\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```javascript\nform.on('error', function(err) {\n});\n```\n\n#### 'aborted'\n\n\nEmitted when the req
uest 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```javascript\nform.on('aborted', function() {\n});\n```\n\n##### 'end'\n```javascript\nform.on('end', function() {\n});\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\n\n## Changelog\n\n### v1.0.14\n\n* Add failing hash tests. (Ben Trask)\n* Enable hash calculation again (Eugene Girshov)\n* Test for immediate data events (Tim Smart)\n* Re-arrange IncomingForm#parse (Tim Smart)\n\n### v1.0.13\n\n* Only update hash if update method exists (Sven Lito)\n* According to travis v0.10 needs to go quoted (Sven Lito)\n* Bumping build node versions (Sven Lito)\n* Additional fix for empty requests (Eugene Girshov)\n* Change the default to 1000, to match the new Node behaviour. (Oran
geDog)\n* Add ability to control maxKeys in the querystring parser. (OrangeDog)\n* Adjust test case to work with node 0.9.x (Eugene Girshov)\n* Update package.json (Sven Lito)\n* Path adjustment according to eb4468b (Markus Ast)\n\n### v1.0.12\n\n* Emit error on aborted connections (Eugene Girshov)\n* Add support for empty requests (Eugene Girshov)\n* Fix name/filename handling in Content-Disposition (jesperp)\n* Tolerate malformed closing boundary in multipart (Eugene Girshov)\n* Ignore preamble in multipart messages (Eugene Girshov)\n* Add support for application/json (Mike Frey, Carlos Rodriguez)\n* Add support for Base64 encoding (Elmer Bulthuis)\n* Add File#toJSON (TJ Holowaychuk)\n* Remove support for Node.js 0.4 & 0.6 (Andrew Kelley)\n* Documentation improvements (Sven Lito, Andre Azevedo)\n* Add support for application/octet-stream (Ion Lupascu, Chris Scribner)\n* Use os.tmpDir() to get tmp directory (Andrew Kelley)\n* Improve package.json (Andrew Kelley, Sven Lito)\n* Fix b
enchmark script (Andrew Kelley)\n* Fix scope issue in incoming_forms (Sven Lito)\n* Fix file handle leak on error (OrangeDog)\n\n### v1.0.11\n\n* Calculate checksums for incoming files (sreuter)\n* Add definition parameters to \"IncomingForm\" as an argument (Math-)\n\n### v1.0.10\n\n* Make parts to be proper Streams (Matt Robenolt)\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 mu
ltipart 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](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2)\n\n### v1.0.1\n\n* Fix package.json to refer to proper main directory. (#68, Dean Landolt)\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1)\n\n### v1.0.0\n\n* Add support for multip
art 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](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0)\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](http://dev.w3.org/2006/webapi/FileAPI/) 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](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11)\n\n### Older releases\n\nThese releases were done before starting to maintain the above Changelog:\n\n* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10)\n* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9)\n* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8)\n* [v0.9.7](htt
ps://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7)\n* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6)\n* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5)\n* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4)\n* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3)\n* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2)\n* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidab
le/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0)\n\n## License\n\nFormidable is licensed under the MIT license.\n\n## Ports\n\n* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable\n\n## Credits\n\n* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js\n",
- "readmeFilename": "Readme.md",
- "dependencies": {},
- "_id": "formidable@1.0.14",
- "_from": "formidable@1.0.14"
-}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js
deleted file mode 100644
index 6a94295..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var path = require('path');
-
-var root = path.join(__dirname, '../');
-exports.dir = {
- root : root,
- lib : root + '/lib',
- fixture : root + '/test/fixture',
- tmp : root + '/test/tmp',
-};
-
-exports.port = 13532;
-
-exports.formidable = require('..');
-exports.assert = require('assert');
-
-exports.require = function(lib) {
- return require(exports.dir.lib + '/' + lib);
-};
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.png
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.png b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.png
deleted file mode 100644
index 20b1a7f..0000000
Binary files a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gz
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gz b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gz
deleted file mode 100644
index 4a85af7..0000000
Binary files a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gz and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gif
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gif b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gif
deleted file mode 100755
index 75b945d..0000000
Binary files a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gif and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
deleted file mode 100644
index e7a4785..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
+++ /dev/null
@@ -1 +0,0 @@
-I am a text file with a funky name!
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.png
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.png b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.png
deleted file mode 100644
index 1c16a71..0000000
Binary files a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
deleted file mode 100644
index 9b6903e..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
+++ /dev/null
@@ -1 +0,0 @@
-I am a plain text file
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
deleted file mode 100644
index 3c9dbe3..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
+++ /dev/null
@@ -1,3 +0,0 @@
-* Opera does not allow submitting this file, it shows a warning to the
- user that the file could not be found instead. Tested in 9.8, 11.51 on OSX.
- Reported to Opera on 08.09.2011 (tracking email DSK-346009@bugs.opera.com).
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/encoding.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/encoding.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/encoding.js
deleted file mode 100644
index fc22026..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/encoding.js
+++ /dev/null
@@ -1,24 +0,0 @@
-module.exports['menu_seperator.png.http'] = [
- {type: 'file', name: 'image', filename: 'menu_separator.png', fixture: 'menu_separator.png',
- sha1: 'c845ca3ea794be298f2a1b79769b71939eaf4e54'}
-];
-
-module.exports['beta-sticker-1.png.http'] = [
- {type: 'file', name: 'sticker', filename: 'beta-sticker-1.png', fixture: 'beta-sticker-1.png',
- sha1: '6abbcffd12b4ada5a6a084fe9e4584f846331bc4'}
-];
-
-module.exports['blank.gif.http'] = [
- {type: 'file', name: 'file', filename: 'blank.gif', fixture: 'blank.gif',
- sha1: 'a1fdee122b95748d81cee426d717c05b5174fe96'}
-];
-
-module.exports['binaryfile.tar.gz.http'] = [
- {type: 'file', name: 'file', filename: 'binaryfile.tar.gz', fixture: 'binaryfile.tar.gz',
- sha1: 'cfabe13b348e5e69287d677860880c52a69d2155'}
-];
-
-module.exports['plain.txt.http'] = [
- {type: 'file', name: 'file', filename: 'plain.txt', fixture: 'plain.txt',
- sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'}
-];
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/misc.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/misc.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/misc.js
deleted file mode 100644
index 4489176..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/misc.js
+++ /dev/null
@@ -1,6 +0,0 @@
-module.exports = {
- 'empty.http': [],
- 'empty-urlencoded.http': [],
- 'empty-multipart.http': [],
- 'minimal.http': [],
-};
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
deleted file mode 100644
index f03b4f0..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
+++ /dev/null
@@ -1,9 +0,0 @@
-module.exports['generic.http'] = [
- {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt',
- sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
-];
-
-module.exports['filename-name.http'] = [
- {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt',
- sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
-];
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/preamble.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/preamble.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/preamble.js
deleted file mode 100644
index d2e4cfd..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/preamble.js
+++ /dev/null
@@ -1,9 +0,0 @@
-module.exports['crlf.http'] = [
- {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt',
- sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
-];
-
-module.exports['preamble.http'] = [
- {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt',
- sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
-];
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
deleted file mode 100644
index eb76fdc..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
+++ /dev/null
@@ -1,21 +0,0 @@
-var properFilename = 'funkyfilename.txt';
-
-function expect(filename) {
- return [
- {type: 'field', name: 'title', value: 'Weird filename'},
- {type: 'file', name: 'upload', filename: filename, fixture: properFilename},
- ];
-};
-
-var webkit = " ? % * | \" < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt";
-var ffOrIe = " ? % * | \" < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt";
-
-module.exports = {
- 'osx-chrome-13.http' : expect(webkit),
- 'osx-firefox-3.6.http' : expect(ffOrIe),
- 'osx-safari-5.http' : expect(webkit),
- 'xp-chrome-12.http' : expect(webkit),
- 'xp-ie-7.http' : expect(ffOrIe),
- 'xp-ie-8.http' : expect(ffOrIe),
- 'xp-safari-5.http' : expect(webkit),
-};
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/workarounds.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/workarounds.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/workarounds.js
deleted file mode 100644
index e59c5b2..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/workarounds.js
+++ /dev/null
@@ -1,8 +0,0 @@
-module.exports['missing-hyphens1.http'] = [
- {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt',
- sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
-];
-module.exports['missing-hyphens2.http'] = [
- {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt',
- sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'},
-];
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
deleted file mode 100644
index a476169..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
+++ /dev/null
@@ -1,72 +0,0 @@
-exports['rfc1867'] =
- { boundary: 'AaB03x',
- raw:
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="field1"\r\n'+
- '\r\n'+
- 'Joe Blow\r\nalmost tricked you!\r\n'+
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
- 'Content-Type: text/plain\r\n'+
- '\r\n'+
- '... contents of file1.txt ...\r\r\n'+
- '--AaB03x--\r\n',
- parts:
- [ { headers: {
- 'content-disposition': 'form-data; name="field1"',
- },
- data: 'Joe Blow\r\nalmost tricked you!',
- },
- { headers: {
- 'content-disposition': 'form-data; name="pics"; filename="file1.txt"',
- 'Content-Type': 'text/plain',
- },
- data: '... contents of file1.txt ...\r',
- }
- ]
- };
-
-exports['noTrailing\r\n'] =
- { boundary: 'AaB03x',
- raw:
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="field1"\r\n'+
- '\r\n'+
- 'Joe Blow\r\nalmost tricked you!\r\n'+
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
- 'Content-Type: text/plain\r\n'+
- '\r\n'+
- '... contents of file1.txt ...\r\r\n'+
- '--AaB03x--',
- parts:
- [ { headers: {
- 'content-disposition': 'form-data; name="field1"',
- },
- data: 'Joe Blow\r\nalmost tricked you!',
- },
- { headers: {
- 'content-disposition': 'form-data; name="pics"; filename="file1.txt"',
- 'Content-Type': 'text/plain',
- },
- data: '... contents of file1.txt ...\r',
- }
- ]
- };
-
-exports['emptyHeader'] =
- { boundary: 'AaB03x',
- raw:
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="field1"\r\n'+
- ': foo\r\n'+
- '\r\n'+
- 'Joe Blow\r\nalmost tricked you!\r\n'+
- '--AaB03x\r\n'+
- 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
- 'Content-Type: text/plain\r\n'+
- '\r\n'+
- '... contents of file1.txt ...\r\r\n'+
- '--AaB03x--\r\n',
- expectError: true,
- };
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
deleted file mode 100644
index 8e10ac9..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
+++ /dev/null
@@ -1,96 +0,0 @@
-var hashish = require('hashish');
-var fs = require('fs');
-var findit = require('findit');
-var path = require('path');
-var http = require('http');
-var net = require('net');
-var assert = require('assert');
-
-var common = require('../common');
-var formidable = common.formidable;
-
-var server = http.createServer();
-server.listen(common.port, findFixtures);
-
-function findFixtures() {
- var fixtures = [];
- findit
- .sync(common.dir.fixture + '/js')
- .forEach(function(jsPath) {
- if (!/\.js$/.test(jsPath)) return;
-
- var group = path.basename(jsPath, '.js');
- hashish.forEach(require(jsPath), function(fixture, name) {
- fixtures.push({
- name : group + '/' + name,
- fixture : fixture,
- });
- });
- });
-
- testNext(fixtures);
-}
-
-function testNext(fixtures) {
- var fixture = fixtures.shift();
- if (!fixture) return server.close();
-
- var name = fixture.name;
- var fixture = fixture.fixture;
-
- uploadFixture(name, function(err, parts) {
- if (err) throw err;
-
- fixture.forEach(function(expectedPart, i) {
- var parsedPart = parts[i];
- assert.equal(parsedPart.type, expectedPart.type);
- assert.equal(parsedPart.name, expectedPart.name);
-
- if (parsedPart.type === 'file') {
- var file = parsedPart.value;
- assert.equal(file.name, expectedPart.filename);
- if(expectedPart.sha1) assert.equal(file.hash, expectedPart.sha1);
- }
- });
-
- testNext(fixtures);
- });
-};
-
-function uploadFixture(name, cb) {
- server.once('request', function(req, res) {
- var form = new formidable.IncomingForm();
- form.uploadDir = common.dir.tmp;
- form.hash = "sha1";
- form.parse(req);
-
- function callback() {
- var realCallback = cb;
- cb = function() {};
- realCallback.apply(null, arguments);
- }
-
- var parts = [];
- form
- .on('error', callback)
- .on('fileBegin', function(name, value) {
- parts.push({type: 'file', name: name, value: value});
- })
- .on('field', function(name, value) {
- parts.push({type: 'field', name: name, value: value});
- })
- .on('end', function() {
- res.end('OK');
- callback(null, parts);
- });
- });
-
- var socket = net.createConnection(common.port);
- var file = fs.createReadStream(common.dir.fixture + '/http/' + name);
-
- file.pipe(socket, {end: false});
- socket.on('data', function () {
- socket.end();
- });
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-json.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-json.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-json.js
deleted file mode 100644
index 28e758e..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-json.js
+++ /dev/null
@@ -1,38 +0,0 @@
-var common = require('../common');
-var formidable = common.formidable;
-var http = require('http');
-var assert = require('assert');
-
-var testData = {
- numbers: [1, 2, 3, 4, 5],
- nested: { key: 'value' }
-};
-
-var server = http.createServer(function(req, res) {
- var form = new formidable.IncomingForm();
-
- form.parse(req, function(err, fields, files) {
- assert.deepEqual(fields, testData);
-
- res.end();
- server.close();
- });
-});
-
-var port = common.port;
-
-server.listen(port, function(err){
- assert.equal(err, null);
-
- var request = http.request({
- port: port,
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- }
- });
-
- request.write(JSON.stringify(testData));
- request.end();
-});
-
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-octet-stream.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-octet-stream.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-octet-stream.js
deleted file mode 100644
index 643d2c6..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-octet-stream.js
+++ /dev/null
@@ -1,45 +0,0 @@
-var common = require('../common');
-var formidable = common.formidable;
-var http = require('http');
-var fs = require('fs');
-var path = require('path');
-var hashish = require('hashish');
-var assert = require('assert');
-
-var testFilePath = path.join(__dirname, '../fixture/file/binaryfile.tar.gz');
-
-var server = http.createServer(function(req, res) {
- var form = new formidable.IncomingForm();
-
- form.parse(req, function(err, fields, files) {
- assert.equal(hashish(files).length, 1);
- var file = files.file;
-
- assert.equal(file.size, 301);
-
- var uploaded = fs.readFileSync(file.path);
- var original = fs.readFileSync(testFilePath);
-
- assert.deepEqual(uploaded, original);
-
- res.end();
- server.close();
- });
-});
-
-var port = common.port;
-
-server.listen(port, function(err){
- assert.equal(err, null);
-
- var request = http.request({
- port: port,
- method: 'POST',
- headers: {
- 'Content-Type': 'application/octet-stream'
- }
- });
-
- fs.createReadStream(testFilePath).pipe(request);
-});
-
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js
deleted file mode 100644
index 2b98598..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js
+++ /dev/null
@@ -1,24 +0,0 @@
-var path = require('path'),
- fs = require('fs');
-
-try {
- global.Gently = require('gently');
-} catch (e) {
- throw new Error('this test suite requires node-gently');
-}
-
-exports.lib = path.join(__dirname, '../../lib');
-
-global.GENTLY = new Gently();
-
-global.assert = require('assert');
-global.TEST_PORT = 13532;
-global.TEST_FIXTURES = path.join(__dirname, '../fixture');
-global.TEST_TMP = path.join(__dirname, '../tmp');
-
-// Stupid new feature in node that complains about gently attaching too many
-// listeners to process 'exit'. This is a workaround until I can think of a
-// better way to deal with this.
-if (process.setMaxListeners) {
- process.setMaxListeners(10000);
-}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
deleted file mode 100644
index 75232aa..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
+++ /dev/null
@@ -1,80 +0,0 @@
-var common = require('../common');
-var CHUNK_LENGTH = 10,
- multipartParser = require(common.lib + '/multipart_parser'),
- MultipartParser = multipartParser.MultipartParser,
- parser = new MultipartParser(),
- fixtures = require(TEST_FIXTURES + '/multipart'),
- Buffer = require('buffer').Buffer;
-
-Object.keys(fixtures).forEach(function(name) {
- var fixture = fixtures[name],
- buffer = new Buffer(Buffer.byteLength(fixture.raw, 'binary')),
- offset = 0,
- chunk,
- nparsed,
-
- parts = [],
- part = null,
- headerField,
- headerValue,
- endCalled = '';
-
- parser.initWithBoundary(fixture.boundary);
- parser.onPartBegin = function() {
- part = {headers: {}, data: ''};
- parts.push(part);
- headerField = '';
- headerValue = '';
- };
-
- parser.onHeaderField = function(b, start, end) {
- headerField += b.toString('ascii', start, end);
- };
-
- parser.onHeaderValue = function(b, start, end) {
- headerValue += b.toString('ascii', start, end);
- }
-
- parser.onHeaderEnd = function() {
- part.headers[headerField] = headerValue;
- headerField = '';
- headerValue = '';
- };
-
- parser.onPartData = function(b, start, end) {
- var str = b.toString('ascii', start, end);
- part.data += b.slice(start, end);
- }
-
- parser.onEnd = function() {
- endCalled = true;
- }
-
- buffer.write(fixture.raw, 'binary', 0);
-
- while (offset < buffer.length) {
- if (offset + CHUNK_LENGTH < buffer.length) {
- chunk = buffer.slice(offset, offset+CHUNK_LENGTH);
- } else {
- chunk = buffer.slice(offset, buffer.length);
- }
- offset = offset + CHUNK_LENGTH;
-
- nparsed = parser.write(chunk);
- if (nparsed != chunk.length) {
- if (fixture.expectError) {
- return;
- }
- puts('-- ERROR --');
- p(chunk.toString('ascii'));
- throw new Error(chunk.length+' bytes written, but only '+nparsed+' bytes parsed!');
- }
- }
-
- if (fixture.expectError) {
- throw new Error('expected parse error did not happen');
- }
-
- assert.ok(endCalled);
- assert.deepEqual(parts, fixture.parts);
-});
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
----------------------------------------------------------------------
diff --git a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js b/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
deleted file mode 100644
index 52ceedb..0000000
--- a/web/demos/package/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
+++ /dev/null
@@ -1,104 +0,0 @@
-var common = require('../common');
-var WriteStreamStub = GENTLY.stub('fs', 'WriteStream');
-
-var File = require(common.lib + '/file'),
- EventEmitter = require('events').EventEmitter,
- file,
- gently;
-
-function test(test) {
- gently = new Gently();
- file = new File();
- test();
- gently.verify(test.name);
-}
-
-test(function constructor() {
- assert.ok(file instanceof EventEmitter);
- assert.strictEqual(file.size, 0);
- assert.strictEqual(file.path, null);
- assert.strictEqual(file.name, null);
- assert.strictEqual(file.type, null);
- assert.strictEqual(file.lastModifiedDate, null);
-
- assert.strictEqual(file._writeStream, null);
-
- (function testSetProperties() {
- var file2 = new File({foo: 'bar'});
- assert.equal(file2.foo, 'bar');
- })();
-});
-
-test(function open() {
- var WRITE_STREAM;
- file.path = '/foo';
-
- gently.expect(WriteStreamStub, 'new', function (path) {
- WRITE_STREAM = this;
- assert.strictEqual(path, file.path);
- });
-
- file.open();
- assert.strictEqual(file._writeStream, WRITE_STREAM);
-});
-
-test(function write() {
- var BUFFER = {length: 10},
- CB_STUB,
- CB = function() {
- CB_STUB.apply(this, arguments);
- };
-
- file._writeStream = {};
-
- gently.expect(file._writeStream, 'write', function (buffer, cb) {
- assert.strictEqual(buffer, BUFFER);
-
- gently.expect(file, 'emit', function (event, bytesWritten) {
- assert.ok(file.lastModifiedDate instanceof Date);
- assert.equal(event, 'progress');
- assert.equal(bytesWritten, file.size);
- });
-
- CB_STUB = gently.expect(function writeCb() {
- assert.equal(file.size, 10);
- });
-
- cb();
-
- gently.expect(file, 'emit', function (event, bytesWritten) {
- assert.equal(event, 'progress');
- assert.equal(bytesWritten, file.size);
- });
-
- CB_STUB = gently.expect(function writeCb() {
- assert.equal(file.size, 20);
- });
-
- cb();
- });
-
- file.write(BUFFER, CB);
-});
-
-test(function end() {
- var CB_STUB,
- CB = function() {
- CB_STUB.apply(this, arguments);
- };
-
- file._writeStream = {};
-
- gently.expect(file._writeStream, 'end', function (cb) {
- gently.expect(file, 'emit', function (event) {
- assert.equal(event, 'end');
- });
-
- CB_STUB = gently.expect(function endCb() {
- });
-
- cb();
- });
-
- file.end(CB);
-});