Skip to content

Please provide example of napi operate arraybuffer. #145

Description

@gzx-miller

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.

Activity

  1. prithivirajmurugan commented on Aug 21, 2023

    @prithivirajmurugan

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions