mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
fix(cli/napi): napi_get_buffer_info
accepts ArrayBufferView
… (#19551)
... not just `Uint8Array`. This PR aligns behavior with Node.js Node-API implementation.
This commit is contained in:
parent
544878cd2b
commit
6729e9c977
1 changed files with 1 additions and 1 deletions
|
@ -1739,7 +1739,7 @@ fn napi_get_buffer_info(
|
||||||
check_env!(env);
|
check_env!(env);
|
||||||
let env = unsafe { &mut *env };
|
let env = unsafe { &mut *env };
|
||||||
let value = napi_value_unchecked(value);
|
let value = napi_value_unchecked(value);
|
||||||
let buf = v8::Local::<v8::Uint8Array>::try_from(value).unwrap();
|
let buf = v8::Local::<v8::ArrayBufferView>::try_from(value).unwrap();
|
||||||
let buffer_name = v8::String::new(&mut env.scope(), "buffer").unwrap();
|
let buffer_name = v8::String::new(&mut env.scope(), "buffer").unwrap();
|
||||||
let abuf = v8::Local::<v8::ArrayBuffer>::try_from(
|
let abuf = v8::Local::<v8::ArrayBuffer>::try_from(
|
||||||
buf.get(&mut env.scope(), buffer_name.into()).unwrap(),
|
buf.get(&mut env.scope(), buffer_name.into()).unwrap(),
|
||||||
|
|
Loading…
Reference in a new issue