mc-publish/scripts/fixes/buffer-fix.ts
Kir_Antipov 7aa44c48ce Documented target-specific properties
Also, GitHub should no longer emit warnings when someone uses them.

Closes #13
2022-07-04 20:19:25 +03:00

10 lines
425 B
TypeScript

import fs from "fs";
export default function fixDeprecatedBuffer() {
const files = fs.readdirSync("./dist", { withFileTypes: true });
for (const file of files.filter(x => x.isFile())) {
const content = fs.readFileSync(`./dist/${file.name}`, "utf8");
const fixedContent = content.replace(/new Buffer\(/g, "Buffer.from(");
fs.writeFileSync(`./dist/${file.name}`, fixedContent, "utf8");
}
}