fs.writeFileSync(file, data[, options])
-
file
<string> | <Buffer> | <URL> | <integer> 文件名或文件描述符¥
file
<string> | <Buffer> | <URL> | <integer> filename or file descriptor -
data
<string> | <Buffer> | <TypedArray> | <DataView> | <Object> -
-
mode
<integer> 默认值:0o666
¥
mode
<integer> Default:0o666
-
flag
<string> 参见 支持文件系统flags
。默认值:'w'
。¥
flag
<string> See support of file systemflags
. Default:'w'
.
返回 undefined
。
¥Returns undefined
.
如果 data
是一个普通对象,它必须有一个自己的(不是继承的)toString
函数属性。
¥If data
is a plain object, it must have an own (not inherited) toString
function property.
mode
选项仅影响新创建的文件。有关详细信息,请参阅 fs.open()
。
¥The mode
option only affects the newly created file. See fs.open()
for more details.
有关详细信息,请参阅此 API 的异步版本的文档:fs.writeFile()
。
¥For detailed information, see the documentation of the asynchronous version of
this API: fs.writeFile()
.