Im sử dụng nút v0.6.12fs.exists phương pháp doesnt tồn tại nữa trong Node.js
Đây là mã của tôi:
var fs = require("fs");
fs.exists(".", function() {
console.log("Whatever);
});
tôi nhận được kết quả này:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object #<Object> has no method 'exists'
at Object.<anonymous> (/home/dbugger/Projects/nodetest/test.js:3:4)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:41)
Có " tồn tại "không được chấp nhận? Tôi có thể sử dụng cái gì sau đó?
Phiên bản nào của nút bạn đã kiểm tra? Bao gồm kết quả của 'console.log (process.version);' - Trong 0.8.14, ['fs.exists'] (http://nodejs.org/api/fs.html#fs_fs_exists_path_callback) tồn tại. nhưng tôi cũng nhớ rằng trong 0.6.16 nó được đặt tên là 'path.exists'. –
Im sử dụng v0.6.12: Ive đã thử fs.path.exists, nhưng nó cũng không hoạt động. –