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 @@ -3968,6 +3968,37 @@ On Linux, positional writes do not work when the file is opened in append mode.
3968
3968
The kernel ignores the position argument and always appends the data to
3969
3969
the end of the file.
3970
3970
3971
+ #### filehandle.write(string[ , position[ , encoding]] )
3972
+ <!-- YAML
3973
+ added: v10.0.0
3974
+ -->
3975
+
3976
+ * ` string ` {string}
3977
+ * ` position ` {integer}
3978
+ * ` encoding ` {string} ** Default:** ` 'utf8' `
3979
+ * Returns: {Promise}
3980
+
3981
+ Write ` string ` to the file. If ` string ` is not a string, then
3982
+ the value will be coerced to one.
3983
+
3984
+ The ` Promise ` is resolved with an object containing a ` bytesWritten ` property
3985
+ identifying the number of bytes written, and a ` buffer ` property containing
3986
+ a reference to the ` string ` written.
3987
+
3988
+ ` position ` refers to the offset from the beginning of the file where this data
3989
+ should be written. If the type of ` position ` is not a ` number ` the data
3990
+ will be written at the current position. See pwrite(2).
3991
+
3992
+ ` encoding ` is the expected string encoding.
3993
+
3994
+ It is unsafe to use ` filehandle.write() ` multiple times on the same file
3995
+ without waiting for the ` Promise ` to be resolved (or rejected). For this
3996
+ scenario, [ ` fs.createWriteStream() ` ] [ ] is strongly recommended.
3997
+
3998
+ On Linux, positional writes do not work when the file is opened in append mode.
3999
+ The kernel ignores the position argument and always appends the data to
4000
+ the end of the file.
4001
+
3971
4002
#### filehandle.writeFile(data, options)
3972
4003
<!-- YAML
3973
4004
added: v10.0.0
You can’t perform that action at this time.
0 commit comments