I notice that blobs transfered over workers aren't readable at all.
- it only applies to blobs coming from
fs.openAsBlob - in-memory constructed blobs works fine.
mini repro:
import{Worker}from'worker_threads'constworker=newWorker('./worker.js')worker.once('message',blob=>{// worker.terminate() // Should be fine to do this as wellblob.text()})// worker.jsimport{parentPort}from'node:worker_threads'import{openAsBlob}from'node:fs'constblob=awaitopenAsBlob(import.meta.url.slice(7))// file:// doesn't workparentPort.postMessage(blob)I would assume that if you also closed the worker it would still work just fine to read the blob, even if it came from another thread...
originally posted by @jimmywarting in #45258 (comment)
maybe also worth trying out to write a test that also use MessageChannel?
...haven't tested if MessageChannel works or not.
I notice that blobs transfered over workers aren't readable at all.
fs.openAsBlobmini repro:
I would assume that if you also closed the worker it would still work just fine to read the blob, even if it came from another thread...
originally posted by @jimmywarting in #45258 (comment)
maybe also worth trying out to write a test that also use
MessageChannel?...haven't tested if
MessageChannelworks or not.