This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Description
In this section of code, it is assumed that all files are UTF-8. There are many cases where such a file is not UTF-8 however, such as images. Such files should be excluded from the replacements.
|
if (stat.isFile()) { |
|
let fileContent = await fs.promises.readFile(fullpath, "utf-8") |
|
|
|
replacements.forEach(re => { |
|
fileContent = fileContent.replace(re.find, re.replace) |
|
}) |
|
|
|
await fs.promises.writeFile(fullpath, fileContent) |
|
} |