I am new to NodeJS and I'm having a hard time decrypting the mode value and figuring out how to change the mode to remove an attribute like read-only. Here is how I found this folder to have a mode of 16822. How do I determine what 16822 means in windows and then how do I change mode so that it does not have a read only attr?
fs.mkdir('./build');
fs.stat('./build', function(err, stats){
if(stats.isDirectory()){
console.log('Its a dir');
for(var i in stats){
if('function' !== typeof stats[i]){
console.log(i + '\t= ' + stats[i]);
}
}
}
});
I believe 0x92 (146) is incorrect. 0x92 is inspecting the 'other' write bit and the 'group' execute bit. What it should be is 0x222 (546).
File Access Settings of various files are :
4000 : Hidden File
2000 : System File
1000 : Archive bit
0400 : Individual read
0200 : Individual write
0100 : Individual execute
0040 : Group read
0020 : Group write
0010 : Group execute
0004 : Other read
0002 : Other write
0001 : Other execute
Where 1 represents execute, 2 represents write and 4 represents read
see http://www.codingdefined.com/2014/10/alter-file-permissions-in-nodejs.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With