GithubHelp home page GithubHelp logo

Comments (3)

usrtax avatar usrtax commented on May 20, 2024

image

when I delete encode, the error is error: Uncaught (in promise) TypeError: Invalid FFI pointer type, expected null, integer or BigInt

+ deno run --unstable -A test.js
Uint8Array(223418) [
  137,  80,  78,  71,  13,  10,  26,  10,  0,   0,   0,  13,  73,  72,  68,
   82,   0,   0,   3,  32,   0,   0,   3, 32,   8,   6,   0,   0,   0, 219,
  112,   6, 104,   0,   3, 104, 129,  73, 68,  65,  84, 120, 156, 236, 253,
  125, 172,  37, 231, 125, 223,   9, 214, 83,  85, 247, 165,  95, 216, 162,
  152,  38,  77, 133, 140,  68, 135, 132, 69, 209, 145,  32, 197,  14, 163,
  216, 227,  73,  35, 241, 174,  55,  26,  5, 144,  98, 216, 142, 227, 137,
  200, 205, 219, 172, 181,  99, 197, 246, 96, 118,
  ... 223318 more items
] 223418
error: Uncaught (in promise) TypeError: Invalid FFI pointer type, expected null, integer or BigInt
  let rawResult = _lib.symbols.toWebp(a0, a0.byteLength, a1)

from deno_bindgen.

littledivy avatar littledivy commented on May 20, 2024

It's not TextEncoder, encode function returns back the input its a TypedArray

from deno_bindgen.

skanehira avatar skanehira commented on May 20, 2024

@usrtax
deno_bindgen cannot return binary data which included by structs because struct is always convert to the JavaScript's Object through JSON.parse

I think If you want to return binary, you have two choice.

  1. Return TypeArray only.
  2. Use base64 for encode binary to String, and decode string to bytes in Deno.

https://github.com/skanehira/deno-clippy/blob/b4b5eabc82964bf97a00394b31f86190923e2482/mod.ts#L38-L50

https://github.com/skanehira/deno-clippy/blob/b4b5eabc82964bf97a00394b31f86190923e2482/src/lib.rs#L15-L26

from deno_bindgen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.