Comments (2)
Hi! Sorry for the trouble. It looks like you're calling JSON.parse
on res.buffer
; this will call toString
on the ArrayBuffer
before attempting to parse. That will result in the string "[object ArrayBuffer]"
.
To fix this, you should be able to use one of the following:
res.json()
will encode the result buffer as a string and parse the result.JSON.parse(res.text())
is equivalent to the above.JSON.parse(new TextDecoder().decode(res))
treatsres
as aDataView
over utf-8 bytes, decodes to a string, then parses the JSON.
Hopefully this helps -- I'll update the JS example this weekend. Thanks!
from extism.
Hi! Sorry for the trouble. It looks like you're calling
JSON.parse
onres.buffer
; this will calltoString
on theArrayBuffer
before attempting to parse. That will result in the string"[object ArrayBuffer]"
.To fix this, you should be able to use one of the following:
res.json()
will encode the result buffer as a string and parse the result.JSON.parse(res.text())
is equivalent to the above.JSON.parse(new TextDecoder().decode(res))
treatsres
as aDataView
over utf-8 bytes, decodes to a string, then parses the JSON.Hopefully this helps -- I'll update the JS example this weekend. Thanks!
Thanks so much!! It works.
from extism.
Related Issues (20)
- discord link in readme is expired HOT 6
- Add support for multiple arguments
- Pass plug-in ID into `set_log_callback` callback function
- Error: http: request body too large (recovered by wazero) HOT 5
- option for a WASM instr limit per call HOT 1
- look into calling `_initialize` on all linked plugins when initializing the guest runtime, not just the main module HOT 1
- Question about plugin return types HOT 3
- Direct disk/filesystem access HOT 8
- Cost of the function call throught host/guest boundary HOT 8
- Synchronizing the content of `wasm` folder HOT 2
- feat: add manifest field to limit the size of Extism vars HOT 1
- Extism gem fails to load on Ruby 3.3.0 on macOS HOT 6
- Async / Await / Generators / Coroutines in Plugins HOT 3
- How to unload a plugin? HOT 3
- Could we get access to the `id` on `CurrentPlugin`
- add a feature to control which wasm backend is enabled? HOT 4
- wasm files are very slow to load (C# PDK, Rust SDK) HOT 7
- getting a list of a plugin’s exported functions HOT 8
- ZMQ with Extism Plugins HOT 6
- allowlist WASI features/interfaces HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extism.