Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-thread URL.createObjectURL #46557

Closed
legendecas opened this issue Feb 8, 2023 · 5 comments
Closed

Cross-thread URL.createObjectURL #46557

legendecas opened this issue Feb 8, 2023 · 5 comments
Labels
buffer Issues and PRs related to the buffer subsystem. feature request Issues that request new features to be added to Node.js. stale

Comments

@legendecas
Copy link
Member

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.

@legendecas legendecas added feature request Issues that request new features to be added to Node.js. buffer Issues and PRs related to the buffer subsystem. labels Feb 8, 2023
@jasnell
Copy link
Member

jasnell commented Feb 8, 2023

Yep, it would be good to see this updated.

@jimmywarting
Copy link

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.

@fursund
Copy link

fursund commented Oct 21, 2023

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

Copy link
Contributor

There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the never-stale Mark issue so that it is never considered stale 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.

@github-actions github-actions bot added the stale label Apr 19, 2024
Copy link
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.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. feature request Issues that request new features to be added to Node.js. stale
Projects
None yet
Development

No branches or pull requests

4 participants