[Feature]: Generate blob parts to support embedding blobs (aka files)
See original GitHub issuescroll down to my 3rd comment: https://github.com/kriszyp/cbor-x/issues/57#issuecomment-1335770916
Original post
if i have something that needs to be read asyncronus or with a stream can i do that then?I’m thinking of ways to best support very large Blob/Files tags…
Here is some wishful thinking:
import { addExtension, Encoder } from 'cbor-x'
let extEncoder = new Encoder()
addExtension({
Class: Blob,
tag: 43311, // register our own extension code (a tag code)
encode (blob, encode) {
const iterable = blob.stream() // returns a async iterators that yields Uint8Arrays
encode(iterable); // return a generator that yields uint8array
}
async decode (readableByteStream) {
const blob = await new Response(stream).blob()
return blob
}
})
Issue Analytics
- State:
- Created 10 months ago
- Comments:26 (7 by maintainers)
Top Results From Across the Web
Blob - Web APIs - MDN Web Docs - Mozilla
The File interface is based on Blob , inheriting blob functionality and expanding it to support files on the user's system.
Read more >4. Storing human-readable data (blobs)
Blobs can be embedded as a part of configuration using in-blob key. This feature is especially useful for config values that are too...
Read more >Blob - The Modern JavaScript Tutorial
Blob consists of an optional string type (a MIME-type usually), plus blobParts – a sequence of other Blob objects, strings and BufferSource ....
Read more >How to Upload Blobs to Azure Storage from an ... - Jon Gallant
In this 3 part series we are going to learn a few methods for developing an Azure Function that uploads blobs to Azure...
Read more >Design and Implement an Azure Storage Strategy
The Blob service provides a feature for asynchronously copying blobs from a source blob to a destination blob. You can run many of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can take a look at the associated commit for my first pass at an implementation (there is some cleanup to do, but I believe it basically works).
I do have plans to start working on this (actually already have started a little bit), as we actually need similar functionality for new features at my job too (more for encoding from iterators, but will be treated roughly the same as blobs). Of course you are welcome to take a stab at it. FWIW, #61 would also make a helpful PR if you think have a (separate) module to do re-sorting of objects would be useful.