Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Encode as blobParts (may include blobs) #70

Open
jimmywarting opened this issue Dec 2, 2022 · 0 comments
Open

[Feature Request]: Encode as blobParts (may include blobs) #70

jimmywarting opened this issue Dec 2, 2022 · 0 comments

Comments

@jimmywarting
Copy link

I just came up with a grate idea that i posted in cbor-x about supporting blobs and having them be kind of exactly the same things as an ArrayBuffer.

just fyi, it's not about supporting encoding/decoding them as a Blob or a File with a custom tags that may include a filename, mimetype and lastModified date. it's just about having blobs be the same equivalent representation as byte arrays

it was a long post so I'm just going to link to kriszyp/cbor-x#57 (comment)


now if i would like to support things such as File tags then i could just as equally just encode it as:

encode({
  name: file.name,
  lastModified: file.lastModified,
  type: file.type,
  content: file // or await file.arrayBuffer()
})

And decode/map it to a file when i later decode it... or write a tag plugin to support this transformation automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant