Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please provide example of napi operate arraybuffer. #145

Open
gzx-miller opened this issue Jul 10, 2020 · 1 comment
Open

Please provide example of napi operate arraybuffer. #145

gzx-miller opened this issue Jul 10, 2020 · 1 comment

Comments

@gzx-miller
Copy link

Please provide example of napi operate arraybuffer.
I want show ffmpeg decoded image to electron canvas.
So, I tried create a ArrayBuffer in js, then pass as param in napi function.
then, I load ffmpeg to decode image one by one,
but there is no clear way to copy image memory to this ArrayBuffer in napi one by one.

@prithivirajmurugan
Copy link

If you are talking about JPEG image

Napi::Buffer<uint8_t> jpeg_buffer = Napi::Buffer<uint8_t>::New(env, jpeg_packet->data, jpeg_packet->size);

This jpeg_buffer can be passed to JS caller as a return value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants