aplbrain / npyjs

Read numpy .npy files in JavaScript
https://aplbrain.github.io/npyjs/
Apache License 2.0
77 stars 21 forks source link

TypeError: Only absolute URLs are supported #30

Closed lixiaofa-lab closed 1 year ago

lixiaofa-lab commented 1 year ago

how to convert dtype: 'float64', data: Float64Array(256) into Array

j6k4m8 commented 1 year ago

Hey @lixiaofa-lab! Can you post the code that you tried, and I'll see if I can help debug?

lixiaofa-lab commented 1 year ago

Thank you. I was trying to convert the data from Float64Array(256) to a normal javaScript array, but MDN doesn't seem to have that way

j6k4m8 commented 1 year ago

You should be able to use Array.from:

let typedArray = new Float64Array(256);
let normalArray = Array.from(typedArray);

Please do reopen this issue (or file another one) if you have any further trouble with the library :)