GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: add filehandle.write(string[, position[, encoding]]) · nodejs/node@a499db7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • fs.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/fs.md‎

Copy file name to clipboardExpand all lines: doc/api/fs.md
+31Lines changed: 31 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -3968,6 +3968,37 @@ On Linux, positional writes do not work when the file is opened in append mode.
39683968
The kernel ignores the position argument and always appends the data to
39693969
the end of the file.
39703970

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+
39714002
#### filehandle.writeFile(data, options)
39724003
<!-- YAML
39734004
added: v10.0.0

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.