Title: vfs: mounted fs.promises.open returns internal VFS handle instead of FileHandle · Issue #65729 · nodejs/node · GitHub
Open Graph Title: vfs: mounted fs.promises.open returns internal VFS handle instead of FileHandle · Issue #65729 · nodejs/node
X Title: vfs: mounted fs.promises.open returns internal VFS handle instead of FileHandle · Issue #65729 · nodejs/node
Description: Version main Platform N/A Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs/promises'; import path from 'node:path'; import vfs from 'node:vfs'; const virtualFs = vfs.create(); virtualFs.writeFileSync('/file.txt', ...
Open Graph Description: Version main Platform N/A Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs/promises'; import path from 'node:path'; import vfs from 'node:vfs'; const virtualFs = vfs.create(...
X Description: Version main Platform N/A Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs/promises'; import path from 'node:path'; import vfs from 'node:vfs'; const...
Opengraph URL: https://github.com/nodejs/node/issues/65729
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"vfs: mounted fs.promises.open returns internal VFS handle instead of FileHandle","articleBody":"### Version\n\nmain\n\n### Platform\n\n```text\nN/A\n```\n\n### Subsystem\n\nvfs\n\n### What steps will reproduce the bug?\n\n```js\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport vfs from 'node:vfs';\n\nconst virtualFs = vfs.create();\nvirtualFs.writeFileSync('/file.txt', 'hello');\n\nconst mountPoint = virtualFs.mount();\nconst handle = await fs.open(path.join(mountPoint, 'file.txt'), 'r');\n\nconsole.log({\n constructorName: handle.constructor.name,\n fd: handle.fd,\n hasReadFile: typeof handle.readFile,\n hasCreateReadStream: typeof handle.createReadStream,\n});\n\nawait handle.close();\nvirtualFs.unmount();\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways\n\n### What is the expected behavior? Why is that the expected behavior?\n\n`fs.promises.open()` should return the same public FileHandle shape as normal `node:fs/promises`, including a numeric `fd` property.\n\n\n\n### What do you see instead?\n\n```console\n{\n constructorName: 'MemoryFileHandle',\n fd: undefined,\n hasReadFile: 'function',\n hasCreateReadStream: 'function'\n}\n```\n\nmounted `fs.promises.open()` returns a VFS-internal `MemoryFileHandle` whose `fd` property is missing.\n\n### Additional information\n\nfs equivalent\n```js\nimport fs from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst dir = await fs.mkdtemp(path.join(os.tmpdir(), 'fs-promises-open-'));\nconst file = path.join(dir, 'file.txt');\n\nawait fs.writeFile(file, 'hello');\n\nconst handle = await fs.open(file, 'r');\n\nconsole.log({\n constructorName: handle.constructor.name,\n fd: handle.fd,\n hasReadFile: typeof handle.readFile,\n hasCreateReadStream: typeof handle.createReadStream,\n});\n\nawait handle.close();\nawait fs.rm(dir, { recursive: true, force: true });\n```\n\nExample Output\n```console\n{\n constructorName: 'FileHandle',\n fd: 18,\n hasReadFile: 'function',\n hasCreateReadStream: 'function'\n}\n```\n\nThe exact `fd` number varies, but it should be a number.","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-09-02T00:43:13Z","url":"https://github.com/nodejs/node/issues/65729"}
| 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:2bff9bd0-1b76-8200-72c9-e47a849fa2c0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9586:55AC6:F015C2:13995FC:6AED594A |
| html-safe-nonce | 6648a7700706710aba8ae4ec101dcab1f4da2a318bd63e001dc44772538cd7b4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTg2OjU1QUM2OkYwMTVDMjoxMzk5NUZDOjZBRUQ1OTRBIiwidmlzaXRvcl9pZCI6IjY5MTI5NDcyNjU2OTc4MzEyNDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 72ffc6364240662086327e6314616a4ca9f8ef9bc8fe2d6b0c69fdfc19f2a4bb |
| hovercard-subject-tag | issue:5318363410 |
| 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/65729/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bf6cccf999502451c38a52e41b8880f10c6a5a78d1b65b19f3c652daf2d1dcba/nodejs/node/issues/65729 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bf6cccf999502451c38a52e41b8880f10c6a5a78d1b65b19f3c652daf2d1dcba/nodejs/node/issues/65729 |
| og:image:alt | Version main Platform N/A Subsystem vfs What steps will reproduce the bug? import fs from 'node:fs/promises'; import path from 'node:path'; import vfs from 'node:vfs'; const virtualFs = vfs.create(... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trivikr |
| 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