-
-
Notifications
You must be signed in to change notification settings - Fork 12
setAttributes
xiao edited this page Nov 8, 2025
·
1 revision
set attributes of a file or directory.
callback:
fswin.setAttributes(pathToFileOrDir, attributes, [callback]);async:
var succeeded = await fswin.setAttributesAsync(pathToFileOrDir, attributes);sync:
var succeeded = fswin.setAttributesSync(pathToFileOrDir, attributes);-
pathToFileOrDiris a string that specifies the path to a file to directory. -
attributesis an object that contains new attributes you want to set. for details see example -
callbackis a function that takes only one argumentsucceeded. -
succeededis a bollean value to indicate whether this operation completed successfully.
var fswin = require('fswin');
var pathToFileOrDir = 'd:\\test.txt';
var attributes = {
IS_ARCHIVED: true, //true means yes
IS_HIDDEN: false, //false means no
//IS_NOT_CONTENT_INDEXED: true, //remove this attribute if you don't want to change it
IS_OFFLINE: false,
IS_READ_ONLY: true,
IS_SYSTEM: false,
IS_TEMPORARY: true,
IS_UNPINNED: true,
IS_PINNED: false
};
//sync
console.log(fswin.setAttributesSync(pathToFileOrDir, attributes) ? 'done' : 'can not set');
//async
console.log(fswin.setAttributes(pathToFileOrDir, attributes, function (succeeded) {
console.log(succeeded ? 'done' : 'can not set');
}) ? 'job queued' : 'failed to queue job');