Method description:
Returns a WriteStream object (writable stream).
grammar:
The code copy is as follows:
fs.createWriteStream(path, [options])
Since this method belongs to the FS module, it is necessary to introduce the FS module before use (var fs= require("fs") )
Receive parameters:
path file path
The option (object) parameter contains the following properties:
The code copy is as follows:
{ flags: 'w',
encoding: null,
mode: 0666 }
option contains a startup option to allow writing data at the beginning of certain files.
The default value of flags is w. If you want to modify a file instead of replacing it, you need to change flags to R+.
example:
The code copy is as follows:
fs.createWriteStream = function(path, options) {
return new WriteStream(path, options);
};