Skip to content

Assistance with what Im doing wrong #57

Answered by hrynko
choff5507 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @choff5507,

I think you're missing the target of the event. Also you don't have to convert the input into base64, since the lib accepts TypedArray as a source as well. You can try the following:

const file = event.target.files[0];
const reader = new FileReader();
reader.onload = () => {
  const typedarray = new Uint8Array(reader.result);
};
reader.readAsArrayBuffer(file);

Then use this typedarray as the source for you component. Hope this helps.

UPD: Added readAsArrayBuffer after noticing in thread.

Replies: 1 comment 12 replies

Comment options

You must be logged in to vote
12 replies
@hrynko
Comment options

@choff5507
Comment options

@choff5507
Comment options

@hrynko
Comment options

@choff5507
Comment options

Answer selected by hrynko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants