由于该方法属于fs模块,使用前需要引入fs模块(var fs = require(“fs”) )
接收参数:
1. filename {String}
2. data {String | Buffer}
3. options {Object}
encoding {String | Null} default = ‘utf8′
mode {Number} default = 438 (aka 0666 in Octal)
flag {String} default = ‘a'
4. callback {Function}
例子:
源码:
原文链接:https://www.f2er.com/js/56836.html