node icon indicating copy to clipboard operation
node copied to clipboard

`Writable.write(buf, sourceOffset, sourceLength)`

Open ronag opened this issue 2 months ago • 1 comments

I want to add a Writable.write(sourceBuf, sourceOffset, sourceLength) API to Writable to get a bit of extra performance in the following case:

writable.write(buf.subarray(offset, length))

The subarray call (particularly regarding allocating Buffer) can be quite slow and avoided in this API. Hence I would like to be able to do something like:

writable.write(buf, offset, length)

I'm not sure how the API should look, though, or whether adding another signature to write would break anyone.

Internally stream implementation would need to explicitly support this by implementing something like _writeSlice and _writevSlice

ronag avatar Dec 02 '24 07:12 ronag