To use appendFileSync from fs-extra library in typescript, you will need to import the fs-extra module and use the appendFileSync method as shown in the code snippet below:
index.ts311 chars11 lines
The appendFileSync method takes two parameters: the first parameter is the path to the file that you want to append data to and the second parameter is the data that you want to add to the file.
Note that appendFileSync blocks the execution until data is written to the file. If an error occurs, it will throw an exception. In the example above, we have used a try-catch block to handle any exceptions that may occur during the operation.
gistlibby LogSnag