【发布时间】:2012-02-09 03:00:40
【问题描述】:
我以为我可以使用“fs”模块来做到这一点,但我找不到合适的功能。
【问题讨论】:
-
我相信这里已经回答了这个问题:stackoverflow.com/questions/4482686/…
-
谢谢。我不知道我是怎么错过的..
标签: node.js filesystems
我以为我可以使用“fs”模块来做到这一点,但我找不到合适的功能。
【问题讨论】:
标签: node.js filesystems
fs = require('fs');
fs.exists(path, function( exists ) {
console.log( ( exists ? "File is there" : "File is not there" ) );
});
【讨论】:
请参阅documentation for the fs module,尤其是“stat”函数系列(stat、fstat、lstat、statSync、fstatSync、lstatSync)。
【讨论】: