question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature]: Generate blob parts to support embedding blobs (aka files)

See original GitHub issue

scroll 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:closed
  • Created 10 months ago
  • Comments:26 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
kriszypcommented, Dec 14, 2022

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).

1reaction
kriszypcommented, Dec 10, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found