const fs = require("fs");
const path = "./huge.bib";
fs.writeFileSync(path, fs.readFileSync("listb.bib", "utf-8"));
let cnt = 0;
const size = 1024*1024*1024; // Size in bytes
while (fs.statSync(path).size <= size) {
const contents = fs.readFileSync(path, "utf8");
fs.appendFileSync(path, contents);
console.log(
`${cnt++}. Doubled the size of the file,\nsize = ${ fs.statSync(path).size / 1024} KB`
);
}
Y29uc3QgZnMgPSByZXF1aXJlKCJmcyIpOwpjb25zdCBwYXRoID0gIi4vaHVnZS5iaWIiOwoKZnMud3JpdGVGaWxlU3luYyhwYXRoLCBmcy5yZWFkRmlsZVN5bmMoImxpc3RiLmJpYiIsICJ1dGYtOCIpKTsKCmxldCBjbnQgPSAwOwoKY29uc3Qgc2l6ZSA9IDEwMjQqMTAyNCoxMDI0OyAgICAgICAgLy8gU2l6ZSBpbiBieXRlcwoKd2hpbGUgKGZzLnN0YXRTeW5jKHBhdGgpLnNpemUgPD0gc2l6ZSkgewogICAgY29uc3QgY29udGVudHMgPSBmcy5yZWFkRmlsZVN5bmMocGF0aCwgInV0ZjgiKTsKICAgIGZzLmFwcGVuZEZpbGVTeW5jKHBhdGgsIGNvbnRlbnRzKTsKICAgIGNvbnNvbGUubG9nKAogICAgICAgIGAke2NudCsrfS4gRG91YmxlZCB0aGUgc2l6ZSBvZiB0aGUgZmlsZSxcbnNpemUgPSAkeyBmcy5zdGF0U3luYyhwYXRoKS5zaXplIC8gMTAyNH0gS0JgCiAgICApOwp9Cg==