01:26
<Alex.hsu>
annevk:
Thanks your help,Could you please give me the relevant forum link?
07:43
<Noam Rosenthal>

Need help with streams!
How do I find the byte size of a chunk, or the total bytes written/read so far?
I need to understand the total byte-size of the stream once it's flushed (it's for https://github.com/w3c/navigation-timing/issues/124).

Maybe Mattias Buelens?

07:59
<Mattias Buelens>

Need help with streams!
How do I find the byte size of a chunk, or the total bytes written/read so far?
I need to understand the total byte-size of the stream once it's flushed (it's for https://github.com/w3c/navigation-timing/issues/124).

Maybe Mattias Buelens?

The idiomatic solution would be to pipe it through a TransformStream that adds up the byteLength of each chunk.

let totalBytes = 0;
const transform = new TransformStream({
  transform(chunk, controller) {
      totalBytes += chunk.byteLength;
      controller.enqueue(chunk);
  },
  flush() {
      console.log(`Downloaded ${totalBytes} bytes`);
  }
});
08:12
<Noam Rosenthal>

The idiomatic solution would be to pipe it through a TransformStream that adds up the byteLength of each chunk.

let totalBytes = 0;
const transform = new TransformStream({
  transform(chunk, controller) {
      totalBytes += chunk.byteLength;
      controller.enqueue(chunk);
  },
  flush() {
      console.log(`Downloaded ${totalBytes} bytes`);
  }
});
Thanks, that's what I was going for, but where is byteLength specified?
08:15
<Mattias Buelens>
The streams spec just uses the [[ByteLength]] internal slot from ECMA-262 directly. But I think Web IDL now has a helper for this.
08:15
<Mattias Buelens>
Ah, here it is: https://webidl.spec.whatwg.org/#buffersource-byte-length
08:17
<Mattias Buelens>
(Oh, btw, adding a TransformStream to a pipe chain currently always increases the "total buffer" of the chain by at least one chunk. Ideally you want an unbuffered transform stream if you only count the total bytes, but that requires https://github.com/whatwg/streams/pull/1190)
08:54
<Noam Rosenthal>
Ah, here it is: https://webidl.spec.whatwg.org/#buffersource-byte-length
Thanks! That's what I was looking for. I think we can switch to unbuffered once that PR is in
14:44
<synack>
Hi there, new here
14:46
<synack>
Where can I donate in xmr?
14:46
<synack>
I learned a lot
15:47
<annevk>
Domenic: oops, not sure how I kept reading over the rollback() heading in the domintro; I had read that text 🙂
15:48
<Domenic>
:)
15:49
<Domenic>
rollback(), as well as deleteForwardEntries() from https://github.com/WICG/app-history/issues/9, are in the category of "in theory, not hard, but haven't made it to the top of the priority list"
15:49
<Domenic>
navigateto/navigatefrom/finished events are also in theory not hard, but in practice there are so many events already firing on each navigation that it's going to be a bit annoying to slot them in.
15:50
<Domenic>
And nobody has complained about any of these missing yet... it's more that they seem like good ideas.
15:58
<annevk>
Domenic: oh, so requestDownload results in canTransition returning false so it might not be entirely compatible to change that later
15:58
<Domenic>
I'm thinking of canTransition going from false to true as similar to going from no exception to exception?
15:59
<annevk>
I think it's different, since you don't see the exception you might get if you use this to guard the method call
16:00
<annevk>
So your code might not account for requestDownload appropriately and just check canTransition
16:00
<annevk>
It's not clear we want to change that though so it probably doesn't matter (and we could always add some kind of transitionRqeuestDownload thingie)
16:02
<Domenic>
Hmm yeah
16:02
<Domenic>
Or maybe we should just see if it's hard to allow you to take over a download... it probably isn't.
19:53
<misanthrope54>
According to the WHATWG html standard the meter element does not have a form attribute. But MDN Web Docs lists the form attribute. I'm just starting with html so excuse me if this is a dumb question.
20:09
<annevk>
misanthrope54: that's not really a question though. 🙂 I recommend reporting it at https://github.com/mdn/content/issues/new/choose