-
-
Notifications
You must be signed in to change notification settings - Fork 12
getAttributes
xiao edited this page Nov 8, 2025
·
1 revision
get attributes of a file or directory.
NOTE: you may wanna use fswin.find for more information about the file or directory
callback:
fswin.getAttributes(path, callback);async:
var result = await fswin.getAttributesAsync(path);sync:
var result = fswin.getAttributesSync(path);-
pathis a string specifies the file or directory. -
callbackis a function that takes only one argumentresult. -
resultis an Object when the path is accessible or null otherwise.
var fswin = require('fswin');
var path = 'c:\\';
//sync
var n;
var result = fswin.getAttributesSync(path);
if (result) {
for (n in result) {
console.log(n + ': ' + result[n]);
}
} else {
console.log(path + ' is inaccessible.');
}
//async
var working = fswin.getAttributes(path, function (result) {
var n;
if (result) {
for (n in result) {
console.log(n + ': ' + result[n]);
}
} else {
console.log(path + ' is inaccessible.');
}
});
console.log(working ? 'job queued' : 'failed to queue job');