Skip to content

Commit

Permalink
fix: create file
Browse files Browse the repository at this point in the history
  • Loading branch information
topliceanurazvan committed Dec 14, 2022
1 parent da0e58e commit f290e5d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ export function createFolder(rootDir: string, folderName: string, callback: (arg
}

export function createFile(rootDir: string, fileName: string, callback: (args: CreateFileFolderCallback) => any) {
return fs.open(path.join(rootDir, fileName), 'wx', err => callback({rootDir, fileFolderName: fileName, err}));
return fs.writeFile(path.join(rootDir, fileName), '', {flag: 'wx'}, err =>
callback({rootDir, fileFolderName: fileName, err})
);
}

export function hasValidExtension(file: string | undefined, extensions: string[]): boolean {
Expand Down

0 comments on commit f290e5d

Please sign in to comment.