From 984db2ceba613a1bd56187398988deed4271465c Mon Sep 17 00:00:00 2001 From: Alan Kligman Date: Fri, 26 Jul 2013 11:59:32 -0400 Subject: [PATCH] Add file type to stats. --- examples/refactoring-test.html | 4 ++-- src/file-system.js | 3 ++- tests/spec/idbfs.spec.js | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/refactoring-test.html b/examples/refactoring-test.html index fa5bcc3..880a7c3 100644 --- a/examples/refactoring-test.html +++ b/examples/refactoring-test.html @@ -37,9 +37,9 @@ fs.open('/myfile', 'w+', function(error, fd) { fs.link('/myfile', '/myotherfile', function(error) { if(error) throw error; console.log('linked'); - fs.unlink('/myfile', function(error) { + fs.stat('/myfile', function(error, stats) { if(error) throw error; - console.log('unlinked'); + console.log(stats); }); }); }); diff --git a/src/file-system.js b/src/file-system.js index 72eac26..0546b8a 100644 --- a/src/file-system.js +++ b/src/file-system.js @@ -950,7 +950,8 @@ define(function(require) { nlinks: result.nlinks, atime: result.atime, mtime: result.mtime, - ctime: result.ctime + ctime: result.ctime, + type: result.mode, }; deferred.resolve(stats); } diff --git a/tests/spec/idbfs.spec.js b/tests/spec/idbfs.spec.js index 638049c..e06df65 100644 --- a/tests/spec/idbfs.spec.js +++ b/tests/spec/idbfs.spec.js @@ -145,6 +145,7 @@ describe('fs.stat', function() { expect(_result['atime']).toEqual(jasmine.any(Number)); expect(_result['mtime']).toEqual(jasmine.any(Number)); expect(_result['ctime']).toEqual(jasmine.any(Number)); + expect(_result['type']).toBeDefined(); }); }); });