Skip to content

Cross-thread URL.createObjectURL  #46557

Description

@legendecas

What is the problem this feature will solve?

The blob url created with URL.createObjectURL is not accessible from the other threads when using buffer.resolveObjectURL.

The FileAPI defines that the blob url store is a per-agent setting: https://w3c.github.io/FileAPI/#url-model. A blob url created in the main thread should be accessible from the worker threads.

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

The blob url store should be shared across threads.

What alternatives have you considered?

This is explicitly documented as https://nodejs.org/api/url.html#urlcreateobjecturlblob:

Blob objects are registered within the current thread. If using Worker Threads, Blob objects registered within one Worker will not be available to other workers or the main thread.

We can keep this as is without the spec compliance.

Activity

  1. added
    feature requestIssues requesting new Node.js features.
    bufferIssues and PRs related to the buffer subsystem.
    on Feb 8, 2023
  2. jasnell commented on Feb 8, 2023

    @jasnell
    Member

    Yep, it would be good to see this updated.

  3. jimmywarting commented on May 26, 2023

    @jimmywarting

    This would solve quite many things

    • import(blobUrl)
    • fetch(blobUrl)
    • new Worker(blobUrl)
    • Reading the content of blob's in experimental loaders that do import() things

    But there are some other blockers atm that dose not even accept blob urls in Worker or import() in the first place - even if the blob urls was constructed in the same thread as the blob where created

    There needs to be some central location (aka blob store) where it can keep track of which blobs do exist and how to access them from basically anywhere.

  4. fursund commented on Oct 21, 2023

    @fursund

    Any way to work around this? What's the alternative way to do this instead of bloburl? Passing arraybuffers around?

  5. github-actions commented on Apr 19, 2024

    @github-actions
    Contributor

    There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the never-stale Issues and PRs exempt from automated stale handling. label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
    For more information on how the project manages feature requests, please consult the feature request management document.

  6. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Apr 19, 2024
  7. github-actions commented on May 19, 2024

    @github-actions
    Contributor

    There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.

    For more information on how the project manages feature requests, please consult the feature request management document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bufferIssues and PRs related to the buffer subsystem.feature requestIssues requesting new Node.js features.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions