second-state / wasmedge-quickjs

A high-performance, secure, extensible, and OCI-complaint JavaScript runtime for WasmEdge.
Apache License 2.0
477 stars 59 forks source link

opts is not an object #130

Open lastmjs opened 7 months ago

lastmjs commented 7 months ago

Here opts is assumed to be an object, but in one of our code paths it was a string like utf-8: https://github.com/second-state/wasmedge-quickjs/blob/main/modules/internal/fs/stream.js#L202

I've added this code to fix it temporarily: opts = typeof opts !== 'object' ? {} : opts;

L-jasmine commented 7 months ago

I'm not very familiar with JavaScript, so if there are bugs like this in JavaScript, feel free to submit a pull request to help us optimize it.