You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to unit test an Angular.js controller that takes an array of files gotten from a drag and drop interface. I need to load a file from the server add it to my mock array then pass it to my parse function.
I'm using the example xhr loader to convert the file into a binary string, and this is the output I get trying to pass the the converted result directly to js-xlsx.
Error: End of data reached (data length = 211771, asked index = 273138). Corrupted zip ?
I have also seen this one.
Uncaught TypeError: Failed to construct 'Blob':
The 1st argument is neither an array, nor does it have indexed properties.
And this one.
Uncaught TypeError: Failed to construct 'Blob':
The 1st argument is neither an array, nor does it have indexed properties.
Somehow I need to load this file from the server and mock it to look like a file so my actual parse function can deal with it in the same way as if it was part of an array of dropped files. Any help with this would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
@SheetJSDev It turns out that this has nothing to do with this library or jszip. Karma, the test runner for Angular, is incapable of serving arbitrary binary files.
At the present time Karma serves binary files "wrong" unless the file extension matches a predefined list of binary formats. .xlsx and .xls aren't on this list. So if you are trying to server yourself a file to use as a mock user provided file js-xlsx will complain about it being corrupt. You can temporarily fix this by changing the file extension to .tar
You can see a bit more of the discussion here #1070
I'm trying to unit test an Angular.js controller that takes an array of files gotten from a drag and drop interface. I need to load a file from the server add it to my mock array then pass it to my parse function.
I'm using the example xhr loader to convert the file into a binary string, and this is the output I get trying to pass the the converted result directly to js-xlsx.
I have also seen this one.
And this one.
Somehow I need to load this file from the server and mock it to look like a file so my actual parse function can deal with it in the same way as if it was part of an array of dropped files. Any help with this would be greatly appreciated.
The text was updated successfully, but these errors were encountered: