'How to render byte array in react
I am building outlook kind of functionality, where I am getting attachments from server in byte array format. Now I want to preview these documents before downloading them. Attachments could be in any form ex: pdf, image, excel, ppt, doc, txt etc.
I found that we can convert byte array to blob object and from blob object I can get blob url using URL.createObjectURL which can be used for rendering the file.
So is there any library which can render blob url on web. I already tried react-file-previewer and react-doc-viewer, but none of them works on blob url.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|