New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"array" type does not support Uint8Array #620
Comments
@dullin So this is a funny issue that boils down to the semantics of typedarray: http://www.ecma-international.org/ecma-262/6.0/#sec-%typedarray%.prototype.map The > var x = [1,2,3], y = new Uint8Array(x)
> x.map(function(v) { return v + "!"; })
[ '1!', '2!', '3!' ]
> y.map(function(v) { return v + "!"; })
Uint8Array [ 0, 0, 0 ] When working with typed arrays like those coming from We do that type of conversion (mapping from an array of one type to an array of another type) in multiple places :( In this case, we can either add a new input type ping @Aymkdn any thoughts? |
Wow! I must admit I'm still new to javascript so didn't know the difference between typed and untyped arrays. Thank you for the thorough and educational explication! |
@dullin typed arrays are relatively new (IE10+, specced in ES6 but not ES5). If you are in node you are better off sticking with |
- phased out Array map invocations (fixes SheetJS#620 h/t @dullin) - "array" type supports Uint8Array - Headless browser examples - blank cells are omitted or stubbed (fixes SheetJS#779 h/t @Domxa) - removed transferrables from demo
I've been having problems using a Uint8Array as data for XLSX.read (using type as 'array').
It's throwing an error when trying to read the signature header of the file. I've checked the array against the signature and everything seemed fined.
I've tracked down the issue to __hexlify which tries to convert the first few bytes into a string but fails to do it correctly.
I have an example of the problem here : https://jsfiddle.net/dullin/hchgjs4g/1/
I've currently circumvented the problem by formating my data as a node Buffer which uses it's version of toString instead of the problematic code.
The text was updated successfully, but these errors were encountered: