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