buffer
buffer copied to clipboard
"File is not a constructor" in Node 16 and below
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
Did you get any solution for this?
No I did not, though not sure if this is particularly important now that Node 18 is deprecated.
@NSeydoux is this still a problem for solid-client?