Optional
options: Optionsimport { filesystem } from "@rjweb/utils"
import fs from "fs"
await fs.promises.writeFile('./file.txt', 'Hello World sir')
console.log(await fs.promises.readFile('./file.txt', 'utf8')) // Hello World sir
await filesystem.replace('./file.txt', 'Hello World', 'Bye World', { async: true }) // Bye World sir
console.log(await fs.promises.readFile('./file.txt', 'utf8')) // Bye World sir
1.12.20
nodejs
Replace with Contents of a File