Skip to content

fix(ext/node): export File class from node:buffer module#32182

Open
veeceey wants to merge 2 commits intodenoland:mainfrom
veeceey:fix/issue-28120-buffer-file-export
Open

fix(ext/node): export File class from node:buffer module#32182
veeceey wants to merge 2 commits intodenoland:mainfrom
veeceey:fix/issue-28120-buffer-file-export

Conversation

@veeceey
Copy link

@veeceey veeceey commented Feb 15, 2026

Node.js 20+ exports the File class from the buffer module. Currently Deno's node:buffer polyfill exports Blob but not File, which causes runtime errors like:

Error: Attempt to export a nullable value for "File"

This breaks frameworks that rely on require('buffer').File, such as Next.js with edge runtime (via Vercel's edge-runtime package).

The fix imports and re-exports the existing File class (from ext:deno_web/09_file.js, which already defines File extends Blob) through the buffer polyfill chain:

  • ext/node/polyfills/internal/buffer.mjs - import and add to mod exports
  • ext/node/polyfills/buffer.ts - re-export
  • ext/node/polyfills/internal/buffer.d.ts - add type declarations

Added a test in tests/unit_node/buffer_test.ts that verifies File is correctly exported and constructable from node:buffer.

Closes #28120

Node.js 20+ exports the File class (which extends Blob) from the
buffer module. Deno's node:buffer polyfill was missing this export,
causing runtime errors in frameworks like Next.js edge runtime that
depend on `require('buffer').File` being available.

Fixes denoland#28120
@CLAassistant
Copy link

CLAassistant commented Feb 15, 2026

CLA assistant check
All committers have signed the CLA.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buffer Polyfill Missing File Export

2 participants