fs.writefile 选项参数的可能值,尤其是只读文件的整数

Possible values for fs.writefile options parameter especially what will be integer for read-only file

fs.writeFile(file, data, options, callback) function中,当涉及到选项时我们可以指定mode(integer)

我想了解不同文件模式的可能整数

您可以找到可用的文件模式 here

您可以根据文档自行创建八进制数。

An easier method of constructing the mode is to use a sequence of three octal digits (e.g. 765). The left-most digit (7 in the example), specifies the permissions for the file owner. The middle digit (6 in the example), specifies permissions for the group. The right-most digit (5 in the example), specifies the permissions for others.

只读应该是0o444