Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement lastModifiedDate

Completes the basic HTML5 API compatibility from a property point of
view.
  • Loading branch information...
commit 85070027d80a5172a60063c574b26132551a9971 1 parent 29716c1
@felixge authored
Showing with 4 additions and 0 deletions.
  1. +2 −0  lib/formidable/file.js
  2. +2 −0  test/simple/test-file.js
View
2  lib/formidable/file.js
@@ -11,6 +11,7 @@ function File(properties) {
this.path = null;
this.name = null;
this.type = null;
+ this.lastModifiedDate = null;
this._writeStream = null;
@@ -44,6 +45,7 @@ File.prototype.open = function() {
File.prototype.write = function(buffer, cb) {
var self = this;
this._writeStream.write(buffer, function() {
+ self.lastModifiedDate = new Date();
self.size += buffer.length;
self.emit('progress', self.size);
cb();
View
2  test/simple/test-file.js
@@ -19,6 +19,7 @@ test(function constructor() {
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);
@@ -54,6 +55,7 @@ test(function write() {
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);
});
Please sign in to comment.
Something went wrong with that request. Please try again.