fs.createWriteStream(path[, options])
Returns a new WriteStream
object. (See Writable Stream).
options
is an object or string with the following defaults:
{ flags: 'w', defaultEncoding: 'utf8', fd: null, mode: 0o666, autoClose: true }
options
may also include a start
option to allow writing data at some position past the beginning of the file. Modifying a file rather than replacing it may require a flags
mode of r+
rather than the default mode w
. The defaultEncoding
can be any one of those accepted by Buffer
.
If autoClose
is set to true (default behavior) on error
or end
the file descriptor will be closed automatically. If autoClose
is false, then the file descriptor won't be closed, even if there's an error. It is your responsibility to close it and make sure there's no file descriptor leak.
Like ReadStream
, if fd
is specified, WriteStream
will ignore the path
argument and will use the specified file descriptor. This means that no 'open'
event will be emitted. Note that fd
should be blocking; non-blocking fd
s should be passed to net.Socket
.
If options
is a string, then it specifies the encoding.
Please login to continue.