diff --git a/clite/core.js b/clite/core.js index 6d1d9a5..aa0588c 100644 --- a/clite/core.js +++ b/clite/core.js @@ -656,6 +656,35 @@ clite.io = { return true; } return vfsapi.mkLink(path,target); + }, + clite.io.fstat = function(fd) { + if (!fd || !fd.node) + return null; + + var stat = Object.create({ + type:clite.lib.getFileType(fd), + uid:fd.node.uid, + gid:fd.node.gid, + size:0, + perms:fd.node.perms + }); + + if (stat.type == 1 || stat.type == 7) + stat.size = fd.node.data.content.length; + + return stat; + }, + clite.io.stat = function(path) { + var fd = getFileDes(path,true,false); + return clite.io.fstat(fd); + }, + clite.io.fchmod = function(fd,mode) { + // TODO: actual chmod + return false; + } + clite.io.chmod = function(path,mode) { + var fd = getFileDes(path,true,false); + return clite.io.fchmod(fd,mode); } }, creat:null, @@ -669,7 +698,11 @@ clite.io = { truncate:null, seek:null, remove:null, - link:null + link:null, + stat:null, + fstat:null, + chmod:null, + fchmod:null }; clite.vfs = {