Skip to content

feat: add support for SharedArrayBuffer in DataViews#1714

Open
KevinEady wants to merge 1 commit intonodejs:mainfrom
KevinEady:add-dataview-with-sharedarraybuffer
Open

feat: add support for SharedArrayBuffer in DataViews#1714
KevinEady wants to merge 1 commit intonodejs:mainfrom
KevinEady:add-dataview-with-sharedarraybuffer

Conversation

@KevinEady
Copy link
Contributor

  • Add support for passing Napi::SharedArrayBuffer into Napi::DataView::New() overloads
  • Add DataView::Buffer()
  • Update docs and tests

@codecov-commenter
Copy link

codecov-commenter commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 63.54%. Comparing base (fe0c48e) to head (8650813).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
napi-inl.h 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1714      +/-   ##
==========================================
+ Coverage   63.50%   63.54%   +0.03%     
==========================================
  Files           3        3              
  Lines        2047     2049       +2     
  Branches      728      728              
==========================================
+ Hits         1300     1302       +2     
  Misses        162      162              
  Partials      585      585              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@legendecas legendecas moved this from Need Triage to In Progress in Node-API Team Project Mar 13, 2026
@KevinEady KevinEady force-pushed the add-dataview-with-sharedarraybuffer branch from 87673ba to 8650813 Compare March 13, 2026 20:28
**NOTE**: If the `Napi::DataView` is not backed by an `Napi::ArrayBuffer`, this
method will terminate the process with a fatal error when using
`NODE_ADDON_API_ENABLE_TYPE_CHECK_ON_AS` or exhibit undefined behavior
otherwise.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should provide a recommendation on NOTEs.

Suggested change
otherwise.
otherwise. Use `Buffer()` instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants