Skip to content

Make disk- blob transferable #47666

Closed as not planned
Closed as not planned
@jimmywarting

Description

@jimmywarting

What is the problem this feature will solve?

I notice that Blob's transfered over workers aren't readable at all.

  • it only applies to blobs coming from fs.openAsBlob
  • in-memory constructed blobs works fine.

Right now they throw an error when trying to send them over.

mini repro:

import { Worker } from 'worker_threads'
const worker = new Worker('./worker.js')
worker.once('message', blob => {
  // Should be fine to do this as well
  blob.text()
})
// worker.js
import { parentPort } from 'node:worker_threads'
import { openAsBlob } from 'node:fs'

const blob = await openAsBlob(new URL(import.meta.url))
parentPort.postMessage(blob)

If a blob originates from a worker thread and is being sent to the main thread over postMessage, then it should still work OK to read the blob even if the worker is terminated.

originally posted by @jimmywarting in #45258 (comment)

What is the feature you are proposing to solve the problem?

Spec issue

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions