grunt.file write/copy 有权限

grunt.file write/copy with permissions

有没有办法在 grunt.file.copy(...) 期间指定文件的权限,除了在复制完成后使用 'fs.chmod'?

否则我将不得不要求整个 'fs' 模块,只是为了更改权限。会不会开销很大?

不幸的是,

grunt.file.copy 没有为此提供任何选项。

但是 grunt copy 任务(来自 grunt-contrib-copy)有一个选项(options.mode,参见 https://github.com/gruntjs/grunt-contrib-copy#mode)。