user3724559
user3724559

Reputation: 239

how to give read write permission to newly created folder using node.js

I am creating a folder every time my code is executed in MAC but it is not having write permission to it due to which my code is failing once the folder is created

Upvotes: 2

Views: 4030

Answers (1)

PatrickD
PatrickD

Reputation: 1156

You can set the permissions of the folder with fs.chmod:

var fs = require('fs');

fs.chmod(pathToYourFolder, '755', function(err){
    if(err){
        //do soemthing with error
    }
});

Upvotes: 2

Related Questions