欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

node.js中的fs.lstat方法使用說(shuō)明

 更新時(shí)間:2014年12月16日 08:48:54   投稿:junjie  
這篇文章主要介紹了node.js中的fs.lstat方法使用說(shuō)明,本文介紹了fs.lstat的方法說(shuō)明、語(yǔ)法、接收參數(shù)、使用實(shí)例和實(shí)現(xiàn)源碼,需要的朋友可以參考下

方法說(shuō)明:

獲取文件信息(不解析符號(hào)鏈接)。

語(yǔ)法:

復(fù)制代碼 代碼如下:

fs.lstat(path, [callback(err, stats)])

由于該方法屬于fs模塊,使用前需要引入fs模塊(var fs= require(“fs”) )

接收參數(shù):

path   文件路徑

callback  回調(diào),傳遞兩個(gè)參數(shù),異常參數(shù)err, 文件信息數(shù)組 stats

stats包含以下信息:(以下信息為案例中讀取的文件信息,非默認(rèn)值)

復(fù)制代碼 代碼如下:

{
 
 dev : 0 ,
 
 mode : 33206 ,
 
 nlink : 1 ,
 
 uid : 0 ,
 
 gid : 0 ,
 
 rdev : 0 ,
 
 ino : 0 ,
 
 size : 378(字節(jié)) ,
 
 atime : Tue Jun 10 2014 13:57:13 GMT +0800 <中國(guó)標(biāo)準(zhǔn)時(shí)間> ,
 
 mtime : Tue Jun 13 2014 09:48:31 GMT +0800 <中國(guó)標(biāo)準(zhǔn)時(shí)間> ,
 
 ctime : Tue Jun 10 2014 13:57:13 GMT +0800 <中國(guó)標(biāo)準(zhǔn)時(shí)間>
 
}

例子:

復(fù)制代碼 代碼如下:

var fs = require('fs');
fs.lstat('content.txt', function(err, stats){
 if(err){
  throw err;
 }else{
  console.log(stats);
 }
})

源碼:

復(fù)制代碼 代碼如下:

fs.lstat = function(path, callback) {
  callback = makeCallback(callback);
  if (!nullCheck(path, callback)) return;
  binding.lstat(pathModule._makeLong(path), callback);
};

相關(guān)文章

最新評(píng)論