@@ -4143,6 +4143,10 @@ This happens when: |
4143 | 4143 | <!-- YAML |
4144 | 4144 | added: v0.0.2 |
4145 | 4145 | changes: |
| 4146 | + - version: REPLACEME |
| 4147 | + pr-url: https://github.com/nodejs/node/pull/34993 |
| 4148 | + description: The `buffer` parameter will stringify an object with an |
| 4149 | + explicit `toString` function. |
4146 | 4150 | - version: v14.0.0 |
4147 | 4151 | pr-url: https://github.com/nodejs/node/pull/31030 |
4148 | 4152 | description: The `buffer` parameter won't coerce unsupported input to |
@@ -4168,7 +4172,7 @@ changes: |
4168 | 4172 | --> |
4169 | 4173 |
|
4170 | 4174 | * `fd` {integer} |
4171 | | -* `buffer` {Buffer|TypedArray|DataView} |
| 4175 | +* `buffer` {Buffer|TypedArray|DataView|string|Object} |
4172 | 4176 | * `offset` {integer} |
4173 | 4177 | * `length` {integer} |
4174 | 4178 | * `position` {integer} |
@@ -4177,7 +4181,8 @@ changes: |
4177 | 4181 | * `bytesWritten` {integer} |
4178 | 4182 | * `buffer` {Buffer|TypedArray|DataView} |
4179 | 4183 |
|
4180 | | -Write `buffer` to the file specified by `fd`. |
| 4184 | +Write `buffer` to the file specified by `fd`. If `buffer` is a normal object, it |
| 4185 | +must have an own `toString` function property. |
4181 | 4186 |
|
4182 | 4187 | `offset` determines the part of the buffer to be written, and `length` is |
4183 | 4188 | an integer specifying the number of bytes to write. |
@@ -4204,6 +4209,10 @@ the end of the file. |
4204 | 4209 | <!-- YAML |
4205 | 4210 | added: v0.11.5 |
4206 | 4211 | changes: |
| 4212 | + - version: REPLACEME |
| 4213 | + pr-url: https://github.com/nodejs/node/pull/34993 |
| 4214 | + description: The `string` parameter will stringify an object with an |
| 4215 | + explicit `toString` function. |
4207 | 4216 | - version: v14.0.0 |
4208 | 4217 | pr-url: https://github.com/nodejs/node/pull/31030 |
4209 | 4218 | description: The `string` parameter won't coerce unsupported input to |
@@ -4222,16 +4231,16 @@ changes: |
4222 | 4231 | --> |
4223 | 4232 |
|
4224 | 4233 | * `fd` {integer} |
4225 | | -* `string` {string} |
| 4234 | +* `string` {string|Object} |
4226 | 4235 | * `position` {integer} |
4227 | 4236 | * `encoding` {string} **Default:** `'utf8'` |
4228 | 4237 | * `callback` {Function} |
4229 | 4238 | * `err` {Error} |
4230 | 4239 | * `written` {integer} |
4231 | 4240 | * `string` {string} |
4232 | 4241 |
|
4233 | | -Write `string` to the file specified by `fd`. If `string` is not a string, then |
4234 | | -an exception will be thrown. |
| 4242 | +Write `string` to the file specified by `fd`. If `string` is not a string, or an |
| 4243 | +object with an own `toString` function property, then an exception is thrown. |
4235 | 4244 |
|
4236 | 4245 | `position` refers to the offset from the beginning of the file where this data |
4237 | 4246 | should be written. If `typeof position !== 'number'` the data will be written at |
@@ -4263,6 +4272,10 @@ details. |
4263 | 4272 | <!-- YAML |
4264 | 4273 | added: v0.1.29 |
4265 | 4274 | changes: |
| 4275 | + - version: REPLACEME |
| 4276 | + pr-url: https://github.com/nodejs/node/pull/34993 |
| 4277 | + description: The `data` parameter will stringify an object with an |
| 4278 | + explicit `toString` function. |
4266 | 4279 | - version: v14.0.0 |
4267 | 4280 | pr-url: https://github.com/nodejs/node/pull/31030 |
4268 | 4281 | description: The `data` parameter won't coerce unsupported input to |
@@ -4288,7 +4301,7 @@ changes: |
4288 | 4301 | --> |
4289 | 4302 |
|
4290 | 4303 | * `file` {string|Buffer|URL|integer} filename or file descriptor |
4291 | | -* `data` {string|Buffer|TypedArray|DataView} |
| 4304 | +* `data` {string|Buffer|TypedArray|DataView|Object} |
4292 | 4305 | * `options` {Object|string} |
4293 | 4306 | * `encoding` {string|null} **Default:** `'utf8'` |
4294 | 4307 | * `mode` {integer} **Default:** `0o666` |
@@ -4304,6 +4317,7 @@ When `file` is a file descriptor, the behavior is similar to calling |
4304 | 4317 | a file descriptor. |
4305 | 4318 |
|
4306 | 4319 | The `encoding` option is ignored if `data` is a buffer. |
| 4320 | +If `data` is a normal object, it must have an own `toString` function property. |
4307 | 4321 |
|
4308 | 4322 | ```js |
4309 | 4323 | const data = new Uint8Array(Buffer.from('Hello Node.js')); |
@@ -4353,6 +4367,10 @@ to contain only `', World'`. |
4353 | 4367 | <!-- YAML |
4354 | 4368 | added: v0.1.29 |
4355 | 4369 | changes: |
| 4370 | + - version: REPLACEME |
| 4371 | + pr-url: https://github.com/nodejs/node/pull/34993 |
| 4372 | + description: The `data` parameter will stringify an object with an |
| 4373 | + explicit `toString` function. |
4356 | 4374 | - version: v14.0.0 |
4357 | 4375 | pr-url: https://github.com/nodejs/node/pull/31030 |
4358 | 4376 | description: The `data` parameter won't coerce unsupported input to |
@@ -4370,7 +4388,7 @@ changes: |
4370 | 4388 | --> |
4371 | 4389 |
|
4372 | 4390 | * `file` {string|Buffer|URL|integer} filename or file descriptor |
4373 | | -* `data` {string|Buffer|TypedArray|DataView} |
| 4391 | +* `data` {string|Buffer|TypedArray|DataView|Object} |
4374 | 4392 | * `options` {Object|string} |
4375 | 4393 | * `encoding` {string|null} **Default:** `'utf8'` |
4376 | 4394 | * `mode` {integer} **Default:** `0o666` |
@@ -4385,6 +4403,10 @@ this API: [`fs.writeFile()`][]. |
4385 | 4403 | <!-- YAML |
4386 | 4404 | added: v0.1.21 |
4387 | 4405 | changes: |
| 4406 | + - version: REPLACEME |
| 4407 | + pr-url: https://github.com/nodejs/node/pull/34993 |
| 4408 | + description: The `buffer` parameter will stringify an object with an |
| 4409 | + explicit `toString` function. |
4388 | 4410 | - version: v14.0.0 |
4389 | 4411 | pr-url: https://github.com/nodejs/node/pull/31030 |
4390 | 4412 | description: The `buffer` parameter won't coerce unsupported input to |
@@ -4402,7 +4424,7 @@ changes: |
4402 | 4424 | --> |
4403 | 4425 |
|
4404 | 4426 | * `fd` {integer} |
4405 | | -* `buffer` {Buffer|TypedArray|DataView} |
| 4427 | +* `buffer` {Buffer|TypedArray|DataView|string|Object} |
4406 | 4428 | * `offset` {integer} |
4407 | 4429 | * `length` {integer} |
4408 | 4430 | * `position` {integer} |
@@ -4415,6 +4437,10 @@ this API: [`fs.write(fd, buffer...)`][]. |
4415 | 4437 | <!-- YAML |
4416 | 4438 | added: v0.11.5 |
4417 | 4439 | changes: |
| 4440 | + - version: REPLACEME |
| 4441 | + pr-url: https://github.com/nodejs/node/pull/34993 |
| 4442 | + description: The `string` parameter will stringify an object with an |
| 4443 | + explicit `toString` function. |
4418 | 4444 | - version: v14.0.0 |
4419 | 4445 | pr-url: https://github.com/nodejs/node/pull/31030 |
4420 | 4446 | description: The `string` parameter won't coerce unsupported input to |
@@ -4425,7 +4451,7 @@ changes: |
4425 | 4451 | --> |
4426 | 4452 |
|
4427 | 4453 | * `fd` {integer} |
4428 | | -* `string` {string} |
| 4454 | +* `string` {string|Object} |
4429 | 4455 | * `position` {integer} |
4430 | 4456 | * `encoding` {string} |
4431 | 4457 | * Returns: {number} The number of bytes written. |
@@ -4788,13 +4814,17 @@ This function does not work on AIX versions before 7.1, it will resolve the |
4788 | 4814 | <!-- YAML |
4789 | 4815 | added: v10.0.0 |
4790 | 4816 | changes: |
| 4817 | + - version: REPLACEME |
| 4818 | + pr-url: https://github.com/nodejs/node/pull/34993 |
| 4819 | + description: The `buffer` parameter will stringify an object with an |
| 4820 | + explicit `toString` function. |
4791 | 4821 | - version: v14.0.0 |
4792 | 4822 | pr-url: https://github.com/nodejs/node/pull/31030 |
4793 | 4823 | description: The `buffer` parameter won't coerce unsupported input to |
4794 | 4824 | buffers anymore. |
4795 | 4825 | --> |
4796 | 4826 |
|
4797 | | -* `buffer` {Buffer|Uint8Array} |
| 4827 | +* `buffer` {Buffer|Uint8Array|string|Object} |
4798 | 4828 | * `offset` {integer} |
4799 | 4829 | * `length` {integer} |
4800 | 4830 | * `position` {integer} |
@@ -4825,19 +4855,23 @@ the end of the file. |
4825 | 4855 | <!-- YAML |
4826 | 4856 | added: v10.0.0 |
4827 | 4857 | changes: |
| 4858 | + - version: REPLACEME |
| 4859 | + pr-url: https://github.com/nodejs/node/pull/34993 |
| 4860 | + description: The `string` parameter will stringify an object with an |
| 4861 | + explicit `toString` function. |
4828 | 4862 | - version: v14.0.0 |
4829 | 4863 | pr-url: https://github.com/nodejs/node/pull/31030 |
4830 | 4864 | description: The `string` parameter won't coerce unsupported input to |
4831 | 4865 | strings anymore. |
4832 | 4866 | --> |
4833 | 4867 |
|
4834 | | -* `string` {string} |
| 4868 | +* `string` {string|Object} |
4835 | 4869 | * `position` {integer} |
4836 | 4870 | * `encoding` {string} **Default:** `'utf8'` |
4837 | 4871 | * Returns: {Promise} |
4838 | 4872 |
|
4839 | | -Write `string` to the file. If `string` is not a string, then |
4840 | | -an exception will be thrown. |
| 4873 | +Write `string` to the file. If `string` is not a string, or an |
| 4874 | +object with an own `toString` function property, then an exception is thrown. |
4841 | 4875 |
|
4842 | 4876 | The `Promise` is resolved with an object containing a `bytesWritten` property |
4843 | 4877 | identifying the number of bytes written, and a `buffer` property containing |
@@ -4861,20 +4895,24 @@ the end of the file. |
4861 | 4895 | <!-- YAML |
4862 | 4896 | added: v10.0.0 |
4863 | 4897 | changes: |
| 4898 | + - version: REPLACEME |
| 4899 | + pr-url: https://github.com/nodejs/node/pull/34993 |
| 4900 | + description: The `data` parameter will stringify an object with an |
| 4901 | + explicit `toString` function. |
4864 | 4902 | - version: v14.0.0 |
4865 | 4903 | pr-url: https://github.com/nodejs/node/pull/31030 |
4866 | 4904 | description: The `data` parameter won't coerce unsupported input to |
4867 | 4905 | strings anymore. |
4868 | 4906 | --> |
4869 | 4907 |
|
4870 | | -* `data` {string|Buffer|Uint8Array} |
| 4908 | +* `data` {string|Buffer|Uint8Array|Object} |
4871 | 4909 | * `options` {Object|string} |
4872 | 4910 | * `encoding` {string|null} **Default:** `'utf8'` |
4873 | 4911 | * Returns: {Promise} |
4874 | 4912 |
|
4875 | 4913 | Asynchronously writes data to a file, replacing the file if it already exists. |
4876 | | -`data` can be a string or a buffer. The `Promise` will be resolved with no |
4877 | | -arguments upon success. |
| 4914 | +`data` can be a string, a buffer, or an object with an own `toString` function |
| 4915 | +property. The `Promise` is resolved with no arguments upon success. |
4878 | 4916 |
|
4879 | 4917 | The `encoding` option is ignored if `data` is a buffer. |
4880 | 4918 |
|
@@ -5492,23 +5530,27 @@ The `atime` and `mtime` arguments follow these rules: |
5492 | 5530 | <!-- YAML |
5493 | 5531 | added: v10.0.0 |
5494 | 5532 | changes: |
| 5533 | + - version: REPLACEME |
| 5534 | + pr-url: https://github.com/nodejs/node/pull/34993 |
| 5535 | + description: The `data` parameter will stringify an object with an |
| 5536 | + explicit `toString` function. |
5495 | 5537 | - version: v14.0.0 |
5496 | 5538 | pr-url: https://github.com/nodejs/node/pull/31030 |
5497 | 5539 | description: The `data` parameter won't coerce unsupported input to |
5498 | 5540 | strings anymore. |
5499 | 5541 | --> |
5500 | 5542 |
|
5501 | 5543 | * `file` {string|Buffer|URL|FileHandle} filename or `FileHandle` |
5502 | | -* `data` {string|Buffer|Uint8Array} |
| 5544 | +* `data` {string|Buffer|Uint8Array|Object} |
5503 | 5545 | * `options` {Object|string} |
5504 | 5546 | * `encoding` {string|null} **Default:** `'utf8'` |
5505 | 5547 | * `mode` {integer} **Default:** `0o666` |
5506 | 5548 | * `flag` {string} See [support of file system `flags`][]. **Default:** `'w'`. |
5507 | 5549 | * Returns: {Promise} |
5508 | 5550 |
|
5509 | 5551 | Asynchronously writes data to a file, replacing the file if it already exists. |
5510 | | -`data` can be a string or a buffer. The `Promise` will be resolved with no |
5511 | | -arguments upon success. |
| 5552 | +`data` can be a string, a buffer, or an object with an own `toString` function |
| 5553 | +property. The `Promise` is resolved with no arguments upon success. |
5512 | 5554 |
|
5513 | 5555 | The `encoding` option is ignored if `data` is a buffer. |
5514 | 5556 |
|
|