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

"File is not a constructor" in Node 16 and below #325

Open
jeswr opened this issue May 18, 2023 · 0 comments
Open

"File is not a constructor" in Node 16 and below #325

jeswr opened this issue May 18, 2023 · 0 comments

Comments

@jeswr
Copy link

jeswr commented May 18, 2023

I have the following index.js

const { File } = require('buffer');
console.log(new File(['Hello World'], 'hello.txt'))

node index succeeds on Node v20.0.0 and v18.16.0.

node index fails with the following error on Node v16.20.0 and v14.21.3

console.log(new File(['Hello World'], 'hello.txt'))
            ^

TypeError: File is not a constructor
    at Object.<anonymous> (/home/jeswr/Documents/GitHub/buffer-file-test/index.js:2:13)
    at Module._compile (node:internal/modules/cjs/loader:1196:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
    at Module.load (node:internal/modules/cjs/loader:1074:32)
    at Function.Module._load (node:internal/modules/cjs/loader:909:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47

Versions
buffer: 6.0.3

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

No branches or pull requests

1 participant