Title: more ways of getting files · Issue #49757 · nodejs/node · GitHub
Open Graph Title: more ways of getting files · Issue #49757 · nodejs/node
X Title: more ways of getting files · Issue #49757 · nodejs/node
Description: What is the problem this feature will solve? it's kind of a #developer-pain that there are no sync version of fs.openAsBlob (aka: fs.openAsBlobSync) they are a Blob instead of Files and therefore lacks a file name and lastModified. So up...
Open Graph Description: What is the problem this feature will solve? it's kind of a #developer-pain that there are no sync version of fs.openAsBlob (aka: fs.openAsBlobSync) they are a Blob instead of Files and therefore l...
X Description: What is the problem this feature will solve? it's kind of a #developer-pain that there are no sync version of fs.openAsBlob (aka: fs.openAsBlobSync) they are a Blob instead of Files and therefo...
Opengraph URL: https://github.com/nodejs/node/issues/49757
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"more ways of getting files","articleBody":"### What is the problem this feature will solve?\r\n\r\nit's kind of a #developer-pain that \r\n1) there are no sync version of `fs.openAsBlob` (aka: fs.openAsBlobSync)\r\n2) they are a `Blob` instead of `File`s and therefore lacks a file name and lastModified. So upgrading them to a File requires figuring out more stuff yourself.\r\n\r\n### What is the feature you are proposing to solve the problem?\r\n\r\nThat we add:\r\n\r\n- [ ] `fs.openAsFile`\r\n- [ ] `fs.openAsFileSync`\r\n- [ ] `fs.openAsBlobSync` (#49759)\r\n\r\n### What alternatives have you considered?\r\n\r\nOnly workaround today is to do:\r\n\r\n```js\r\nconst name = path.basename(filePath)\r\nconst stat = fs.statSync(filePath)\r\nconst blob = await fs.openAsBlob(filePath)\r\nconst file = new File([blob], name, { \r\n type: blob.type,\r\n lastModified: Number(stat.mtime)\r\n })\r\n```\r\nwould be a heck a lot easier if i could just do:\r\n```js\r\nconst file = fs.openAsFileSync(filePath)\r\n```\r\nand there is no way of getting around it cuz the async openAsBlob is the only thing you can work with. which makes your own code having to be async as well.","author":{"url":"https://github.com/jimmywarting","@type":"Person","name":"jimmywarting"},"datePublished":"2023-09-21T23:59:52Z","url":"https://github.com/nodejs/node/issues/49757"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| 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:b98f19d9-b83c-6bab-badd-b2749e868569 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 81B2:10572B:EFE525:13A2569:6AED5B34 |
| html-safe-nonce | 36bad7a609093cbe28172094be1d96e988caa9c1441838b4e6cea9df1612b458 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MUIyOjEwNTcyQjpFRkU1MjU6MTNBMjU2OTo2QUVENUIzNCIsInZpc2l0b3JfaWQiOiIxOTgwNjMzNDU2MDYzNjM0MjI4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 82d811ced904dfad3061172b713f85fff01ffed9c89d00dee4f8cb1ccb83ae5d |
| hovercard-subject-tag | issue:1907938663 |
| 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/49757/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b94b2f2222e8ec4e747880d81b87c7e5c73cd4597a32dcc9ddd3503a56edb088/nodejs/node/issues/49757 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b94b2f2222e8ec4e747880d81b87c7e5c73cd4597a32dcc9ddd3503a56edb088/nodejs/node/issues/49757 |
| og:image:alt | What is the problem this feature will solve? it's kind of a #developer-pain that there are no sync version of fs.openAsBlob (aka: fs.openAsBlobSync) they are a Blob instead of Files and therefore l... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jimmywarting |
| hostname | github.com |
| expected-hostname | github.com |
| None | 56fb42677ae87ed3e64410323d67980aa65d0485568a7858f874e7edfc6d1c11 |
| 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 | 9c9a37e2423ed382cf39f70b5aa4b4858b40a3b0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width