fork download
  1. const fs = require("fs");
  2. const path = "./huge.bib";
  3.  
  4. fs.writeFileSync(path, fs.readFileSync("listb.bib", "utf-8"));
  5.  
  6. let cnt = 0;
  7.  
  8. const size = 1024*1024*1024; // Size in bytes
  9.  
  10. while (fs.statSync(path).size <= size) {
  11. const contents = fs.readFileSync(path, "utf8");
  12. fs.appendFileSync(path, contents);
  13. console.log(
  14. `${cnt++}. Doubled the size of the file,\nsize = ${ fs.statSync(path).size / 1024} KB`
  15. );
  16. }
  17.  
Runtime error #stdin #stdout #stderr 0.03s 18556KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
prog.js:1:7 ReferenceError: require is not defined
Stack:
  @prog.js:1:7