File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -3941,6 +3941,37 @@ On Linux, positional writes do not work when the file is opened in append mode.
39413941The kernel ignores the position argument and always appends the data to
39423942the end of the file.
39433943
3944+ #### filehandle.write(string[ , position[ , encoding]] )
3945+ <!-- YAML
3946+ added: v10.0.0
3947+ -->
3948+
3949+ * ` string ` {string}
3950+ * ` position ` {integer}
3951+ * ` encoding ` {string} ** Default:** ` 'utf8' `
3952+ * Returns: {Promise}
3953+
3954+ Write ` string ` to the file. If ` string ` is not a string, then
3955+ the value will be coerced to one.
3956+
3957+ The ` Promise ` is resolved with an object containing a ` bytesWritten ` property
3958+ identifying the number of bytes written, and a ` buffer ` property containing
3959+ a reference to the ` string ` written.
3960+
3961+ ` position ` refers to the offset from the beginning of the file where this data
3962+ should be written. If the type of ` position ` is not a ` number ` the data
3963+ will be written at the current position. See pwrite(2).
3964+
3965+ ` encoding ` is the expected string encoding.
3966+
3967+ It is unsafe to use ` filehandle.write() ` multiple times on the same file
3968+ without waiting for the ` Promise ` to be resolved (or rejected). For this
3969+ scenario, [ ` fs.createWriteStream() ` ] [ ] is strongly recommended.
3970+
3971+ On Linux, positional writes do not work when the file is opened in append mode.
3972+ The kernel ignores the position argument and always appends the data to
3973+ the end of the file.
3974+
39443975#### filehandle.writeFile(data, options)
39453976<!-- YAML
39463977added: v10.0.0
You can’t perform that action at this time.
0 commit comments