aboutsummaryrefslogtreecommitdiff
path: root/node_modules/formidable/lib/file.js
diff options
context:
space:
mode:
authorAlee14 <Alee14498@gmail.com>2017-07-28 16:20:27 -0400
committerAlee14 <Alee14498@gmail.com>2017-07-28 16:20:27 -0400
commitd35e0862e6b60fe3c4f823371627359f3ce3e68b (patch)
treed98b788eb1abf0a8814207b993b4e22efe711deb /node_modules/formidable/lib/file.js
parent20993df62e7e38ed43428aafa5981afc3543bdea (diff)
downloadAleeBot-d35e0862e6b60fe3c4f823371627359f3ce3e68b.tar.gz
AleeBot-d35e0862e6b60fe3c4f823371627359f3ce3e68b.tar.bz2
AleeBot-d35e0862e6b60fe3c4f823371627359f3ce3e68b.zip
Removing node modules (go get them yourself :P)
Diffstat (limited to 'node_modules/formidable/lib/file.js')
-rw-r--r--node_modules/formidable/lib/file.js76
1 files changed, 0 insertions, 76 deletions
diff --git a/node_modules/formidable/lib/file.js b/node_modules/formidable/lib/file.js
deleted file mode 100644
index 9974451..0000000
--- a/node_modules/formidable/lib/file.js
+++ /dev/null
@@ -1,76 +0,0 @@
-if (global.GENTLY) require = GENTLY.hijack(require);
-
-var util = require('util'),
- fs = require('fs'),
- 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 fs.WriteStream(this.path);
-};
-
-File.prototype.toJSON = function() {
- var json = {
- size: this.size,
- path: this.path,
- name: this.name,
- type: this.type,
- mtime: this.lastModifiedDate,
- length: this.length,
- filename: this.filename,
- mime: this.mime
- };
- if (this.hash && this.hash != "") {
- json.hash = this.hash;
- }
- return json;
-};
-
-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();
- });
-};