Skip to content

Commit

Permalink
write file allows to specify filesystem flags
Browse files Browse the repository at this point in the history
  • Loading branch information
gturi committed Feb 28, 2024
1 parent da9ffca commit a6958fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/file-system-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export class FileSystemUtils {
this.writeFile(filePath, prettyJson);
}

static writeFile(filePath: string, data: string): void {
static writeFile(filePath: string, data: string, flag: string = 'w'): void {

Check failure on line 41 in src/util/file-system-utils.ts

View workflow job for this annotation

GitHub Actions / lint

Type string trivially inferred from a string literal, remove type annotation
const fileDirectory = path.dirname(filePath);
this.createFolderIfNotExists(fileDirectory);
fs.writeFileSync(filePath, data, {encoding:'utf8'});
fs.writeFileSync(filePath, data, { encoding: 'utf8', flag: flag });
}

static createFolderIfNotExists(folderPath: string): void {
Expand Down

0 comments on commit a6958fe

Please sign in to comment.