Optimize fs.stat

This commit is contained in:
Subash Pathak 2014-10-02 23:35:37 +05:45
parent cc4897f8c1
commit 9f8a5a7af3

View file

@ -29,6 +29,7 @@ splitPath = (p) ->
nextInode = 0 nextInode = 0
uid = if process.getuid? then process.getuid() else 0 uid = if process.getuid? then process.getuid() else 0
gid = if process.getgid? then process.getgid() else 0 gid = if process.getgid? then process.getgid() else 0
fakeTime = new Date()
asarStatsToFsStats = (stats) -> asarStatsToFsStats = (stats) ->
{ {
dev: 1, dev: 1,
@ -38,10 +39,10 @@ asarStatsToFsStats = (stats) ->
uid: uid, uid: uid,
gid: gid, gid: gid,
rdev: 0, rdev: 0,
atime: stats.atime || new Date(), atime: stats.atime || fakeTime,
birthtime: stats.birthtime || new Date(), birthtime: stats.birthtime || fakeTime,
mtime: stats.mtime || new Date(), mtime: stats.mtime || fakeTime,
ctime: stats.ctime || new Date(), ctime: stats.ctime || fakeTime,
size: stats.size, size: stats.size,
isFile: -> stats.isFile isFile: -> stats.isFile
isDirectory: -> stats.isDirectory isDirectory: -> stats.isDirectory