Skip to content

Commit 847749f

Browse files
committed
squash: remove "named params" support
This is going to be introduced separately
1 parent 037561c commit 847749f

File tree

5 files changed

+5
-232
lines changed

5 files changed

+5
-232
lines changed

doc/api/fs.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -619,25 +619,6 @@ On Linux, positional writes do not work when the file is opened in append mode.
619619
The kernel ignores the position argument and always appends the data to
620620
the end of the file.
621621
622-
#### `filehandle.write(buffer, options)`
623-
624-
<!-- YAML
625-
added: REPLACEME
626-
-->
627-
628-
* `buffer` {Buffer|TypedArray|DataView}
629-
* `options` {Object}
630-
* `offset` {integer} **Default:** `0`
631-
* `length` {integer} **Default:** `buffer.byteLength - offset`
632-
* `position` {integer} **Default:** `null`
633-
* Returns: {Promise}
634-
635-
Write `buffer` to the file.
636-
637-
Similar to the above `filehandle.write` function, this version takes an
638-
optional `options` object. If no `options` object is specified, it will
639-
default with the above values.
640-
641622
#### `filehandle.write(string[, position[, encoding]])`
642623
643624
<!-- YAML
@@ -5784,23 +5765,6 @@ changes:
57845765
For detailed information, see the documentation of the asynchronous version of
57855766
this API: [`fs.write(fd, buffer...)`][].
57865767
5787-
### `fs.writeSync(fd, buffer, options)`
5788-
5789-
<!-- YAML
5790-
added: REPLACEME
5791-
-->
5792-
5793-
* `fd` {integer}
5794-
* `buffer` {Buffer|TypedArray|DataView}
5795-
* `options` {Object}
5796-
* `offset` {integer} **Default:** `0`
5797-
* `length` {integer} **Default:** `buffer.byteLength - offset`
5798-
* `position` {integer} **Default:** `null`
5799-
* Returns: {number} The number of bytes written.
5800-
5801-
For detailed information, see the documentation of the asynchronous version of
5802-
this API: [`fs.write(fd, buffer...)`][].
5803-
58045768
### `fs.writeSync(fd, string[, position[, encoding]])`
58055769
58065770
<!-- YAML

lib/fs.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -854,26 +854,15 @@ ObjectDefineProperty(write, internalUtil.customPromisifyArgs,
854854
* specified `fd` (file descriptor).
855855
* @param {number} fd
856856
* @param {Buffer | TypedArray | DataView | string} buffer
857-
* @param {{
858-
* offset?: number;
859-
* length?: number;
860-
* position?: number;
861-
* }} [offset]
857+
* @param {number} [offset]
858+
* @param {number} [length]
859+
* @param {number} [position]
862860
* @returns {number}
863861
*/
864862
function writeSync(fd, buffer, offset, length, position) {
865863
fd = getValidatedFd(fd);
866864
const ctx = {};
867865
let result;
868-
869-
if (typeof offset === 'object' && offset !== null) {
870-
({
871-
offset = 0,
872-
length = buffer.byteLength - offset,
873-
position = null
874-
} = offset);
875-
}
876-
877866
if (isArrayBufferView(buffer)) {
878867
if (position === undefined)
879868
position = null;

lib/internal/fs/promises.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -560,19 +560,8 @@ async function readv(handle, buffers, position) {
560560
return { bytesRead, buffers };
561561
}
562562

563-
async function write(handle, bufferOrOptions, offset, length, position) {
564-
let buffer = bufferOrOptions;
565-
if (!isArrayBufferView(buffer) && typeof buffer !== 'string') {
566-
validateBuffer(bufferOrOptions?.buffer);
567-
({
568-
buffer,
569-
offset = 0,
570-
length = buffer.byteLength - offset,
571-
position = null
572-
} = bufferOrOptions);
573-
}
574-
575-
if (buffer.byteLength === 0)
563+
async function write(handle, buffer, offset, length, position) {
564+
if (buffer?.byteLength === 0)
576565
return { bytesWritten: 0, buffer };
577566

578567
if (isArrayBufferView(buffer)) {

test/parallel/test-fs-promises-write-optional-params.js

Lines changed: 0 additions & 87 deletions
This file was deleted.

test/parallel/test-fs-write-sync-optional-params.js

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)