javascript中的file_put_contents是否相同?

jem*_*emz 7 javascript node.js

请问,javascript中file_put_contents的等价物是什么?

先感谢您.

T.J*_*der 9

在JavaScript?没有.

在NodeJS?是的,它被称为writeFile.这是文档中的示例:

fs.writeFile('message.txt', 'Hello Node', function (err) {
  if (err) throw err;
  console.log('It\'s saved!');
});
Run Code Online (Sandbox Code Playgroud)