FileReader
FileReader copied to clipboard
Newlines are inserted every 76 characters
When you read files in browsers with native support for FileReader then the result is one long string. However when using this polyfill newlines are inserted every 76 characters. This doesn't seem to make any difference when reading images but zip files read this way will not work with zip.js.
While base64 is meant to have a newline every 64 or 76 characters, what we're actually dealing with here are data URIs which are meant to be a single line.
To work around this issue I'm currently just replacing all whitespace in the result with .replace(/\s/gm, '')
.