Updates a text file based on a provided update function.
The update function takes the file's current source string as a parameter and should return a string.
Parameters
filepath: string
The path to the file to update.
update: ((src) => string | Promise<string>)
The function to update the file. Takes the current source string as a parameter and should return a string.
(src): string | Promise<string>
Parameters
src: string
Returns string | Promise<string>
encoding: BufferEncoding = 'utf8'
The encoding to use when reading and writing the file.
Updates a text file based on a provided update function. The update function takes the file's current source string as a parameter and should return a string.