Skip to content

Commit

Permalink
Remove usage of JsBuffer::external as it isn't supported in Electron.
Browse files Browse the repository at this point in the history
  • Loading branch information
tec27 committed Jan 16, 2024
1 parent 77f5c19 commit 0a0fed9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
NEW_VERSION: ${{ github.event.inputs.release-version }}

- name: Compile .node
run: pnpm run build-debug
run: pnpm run build-release

- name: Sign binary
env:
Expand Down
6 changes: 4 additions & 2 deletions native/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ impl RegistryThread {
Data::U32(n) => Ok(cx.number(n as f64).upcast()),
Data::U64(n) => Ok(cx.number(n as f64).upcast()),
Data::Binary(b) => {
let typed_array = JsBuffer::external(&mut cx, b);
Ok(typed_array.upcast())
let mut buffer = JsBuffer::new(&mut cx, b.len())?;
let buffer_data = buffer.as_mut_slice(&mut cx);
buffer_data.copy_from_slice(&b);
Ok(buffer.upcast())
}
t => cx.throw_error(format!("Unsupported registry type: {}", t)),
},
Expand Down

0 comments on commit 0a0fed9

Please sign in to comment.