Title: Worker instantiation from URLs · Issue #30780 · nodejs/node · GitHub
Open Graph Title: Worker instantiation from URLs · Issue #30780 · nodejs/node
X Title: Worker instantiation from URLs · Issue #30780 · nodejs/node
Description: When creating workers from within modules, we don't have __filename or __dirname so rather have to rely on import.meta.url, something like: import { Worker } from 'worker_threads'; import { fileURLToPath } from 'url'; new Worker(fileURLT...
Open Graph Description: When creating workers from within modules, we don't have __filename or __dirname so rather have to rely on import.meta.url, something like: import { Worker } from 'worker_threads'; import { fileURL...
X Description: When creating workers from within modules, we don't have __filename or __dirname so rather have to rely on import.meta.url, something like: import { Worker } from 'worker_threads'; impo...
Opengraph URL: https://github.com/nodejs/node/issues/30780
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Worker instantiation from URLs","articleBody":"When creating workers from within modules, we don't have `__filename` or `__dirname` so rather have to rely on import.meta.url, something like:\r\n\r\n```js\r\nimport { Worker } from 'worker_threads';\r\nimport { fileURLToPath } from 'url';\r\nnew Worker(fileURLToPath(import.meta.url));\r\n```\r\n\r\nTo avoid the `fileURLToPath` call being necessary here, should we consider supporting URLs as input into `new Worker`?","author":{"url":"https://github.com/guybedford","@type":"Person","name":"guybedford"},"datePublished":"2019-12-03T20:41:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/30780/node/issues/30780"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f203d550-59af-062c-78f2-65cfa83c71ef |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8082:244C0:35B354:4CE6DE:6A4E6B71 |
| html-safe-nonce | 01b132018f41d0091977047adf6b09156106d0ad6722992379355dddb50a70b6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDgyOjI0NEMwOjM1QjM1NDo0Q0U2REU6NkE0RTZCNzEiLCJ2aXNpdG9yX2lkIjoiNDk3Nzc3MTQyNzQ1MTAwNTgwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9a8a1daf6c1d53a7f901bb3ba377a0211f4f4128f515213f6c80e15e345a04f8 |
| hovercard-subject-tag | issue:532252447 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/30780/issue_layout |
| twitter:image | https://opengraph.githubassets.com/74385df2c886b3a93dbe855e2a9d7deec32bbc455396bbe5ac214dc56d803e9f/nodejs/node/issues/30780 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/74385df2c886b3a93dbe855e2a9d7deec32bbc455396bbe5ac214dc56d803e9f/nodejs/node/issues/30780 |
| og:image:alt | When creating workers from within modules, we don't have __filename or __dirname so rather have to rely on import.meta.url, something like: import { Worker } from 'worker_threads'; import { fileURL... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | guybedford |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width