Skip to content

ArrayBuffer -> Blob? #22

@Alch-Emi

Description

@Alch-Emi

Hello!

I was wondering if there's any way to turn an ArrayBuffer into a Blob. If I understand correctly, the JavaScript implementation of new Blob(...) allows for passing an array of blob parts, which can include ArrayBuffer (js) and ArrayBufferView (js). I don't see anything similar in the Web.File.Blob docs though, so I was wondering if there's a recommended way to do this.

My use case, in case of XY problems: I'm downloading an encrypted file using purescript-fetch, then decrypting it using purescript-subtlecrypto, which yields an ArrayBuffer (which I have a known image/* MIME for) that I want to display to the user. I know I could use data urls, but I'd like to avoid the memory/cpu overhead if possible.

Also, I'm a bit of a purescript novice, so apologies in advance if I've missed something that's obvious to more experienced users.

Thanks for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions