01:47 | <sideshowbarker> | sideshowbarker: Yeah, spec.inputSource.mtime() (for input types that support it) Perfect — thanks much |
12:24 | <David Halls> | Hi, I've got a question about stream reader closed promise, specifically whether it should resolve before all enqueued data has been read |
12:27 | <David Halls> | In this program, I'm seeing data not read yet being logged. I was assuming reader.closed wouldn't get resolved until the program had read the data. I've read the spec and it saysclosed should be resolved after the queue of data is empty.
const rs = new ReadableStream({
start(controller) {
controller.enqueue(new Uint8Array(3));
controller.close();
}
});
let data = null;
const reader = rs.getReader();
reader.closed.then(() => {
if (!data) {
console.error('data not read yet');
}
});
data = await reader.read();
console.log(data);
data = await reader.read();
console.log(data);
|
12:39 | <David Halls> | In this algorithm: https://streams.spec.whatwg.org/#rs-default-controller-private-pull you can see what's happening: ReadableStreamClose is performed before the read request's chunk steps. |
12:40 | <David Halls> | I would expect that to be the other way around (i.e. resolve the final read request before resolving the closed promise) |