在JavaScript中有file_put_contents的等价物吗?

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

先谢谢你。

在JavaScript中? 没有。

在NodeJS? 是的,它被称为writeFile 。 以下是文档中的示例:

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