Skip to content

feat(volume): implement readv and writev#946

Merged
G-Rath merged 8 commits intostreamich:masterfrom
uhyo:readv-writev
Sep 22, 2023
Merged

feat(volume): implement readv and writev#946
G-Rath merged 8 commits intostreamich:masterfrom
uhyo:readv-writev

Conversation

@uhyo
Copy link
Copy Markdown
Contributor

@uhyo uhyo commented Aug 21, 2023

This PR addresses four missing features (plus two not mentioned there) listed in #735.

  • Adds readv, writev, readvSync and writevSync to Volume.
  • Adds FileHandle#readv and FileHandle#writev.

As a bonus, I modified the existing read implementation:

  • modified the signature of read so that position can receive null, which better aligns to the readv signature. In fact, passing null was already working expect that TypeScript complained about that.
  • passing -1 to position is now equivalent to passing null for better compatibility with Node.
  • wrote missing tests.
  • implemented range check for the “read more than buffer space” case.

I also modified the existing write implementation:

  • passing -1 to position is now equivalent to passing null for better compatibility with Node.

@uhyo
Copy link
Copy Markdown
Contributor Author

uhyo commented Sep 20, 2023

@G-Rath Thank you for review! There was a conflict so I updated this PR. Hope you can recheck this 🙂

@G-Rath G-Rath merged commit 966e17e into streamich:master Sep 22, 2023
github-actions bot pushed a commit that referenced this pull request Sep 22, 2023
# [4.4.0](v4.3.0...v4.4.0) (2023-09-22)

### Features

* **volume:** `toJSON` now accepts the `asBuffer` parameter ([#952](#952)) ([91a3742](91a3742))
* **volume:** implement readv and writev ([#946](#946)) ([966e17e](966e17e))
@streamich
Copy link
Copy Markdown
Owner

🎉 This PR is included in version 4.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@uhyo uhyo deleted the readv-writev branch September 22, 2023 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants