版本:14.1.0
平台:Windows 10
子系统:none
> error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be
> of type string or an instance of Buffer, TypedArray, or DataView.
> Received type number (7) this is the code:
const fs = require('fs')
fs.writeFileSync('notes.txt', 'NODEJS')
fs.appendFileSync('notes.txt', 7 )
我希望得到一个文件:NODEJS7
我知道了:NODEJS
正确地使用了先前的版本!
最佳答案
我认为fs.appendFileSync不再接受数字类型。
如果有变量,则可以将其作为模板字符串传递,也可以使用to.String()
方法。
关于javascript - NodeJs:fs.appendFileSync在数据参数 Node v14中不接受数字类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61564130/