Search code examples
gruntjsgrunt-contrib-copygruntfile

grunt.file write/copy with permissions


Is there a way to specify the permissions of a file during a grunt.file.copy(...), except using the 'fs.chmod' after copy has finished?

I will have to require the whole 'fs' module otherwise, just for changing the permissions. Will it be a lot of overhead?


Solution

  • grunt.file.copy does not provide any option for that, unfortunately.

    But the grunt copy task (from grunt-contrib-copy) has an option for that (options.mode, see https://github.com/gruntjs/grunt-contrib-copy#mode).