fix(fs): fix panic due to unwrap & truncate by default (#847)

* fix(fs): fix panic due to unwrap & truncate by default

closes #846

* fmt and change file
This commit is contained in:
Amr Bashir
2023-12-27 15:27:45 +02:00
committed by GitHub
parent 38b5d37b54
commit c60123093d
5 changed files with 43 additions and 11 deletions
+3 -1
View File
@@ -980,6 +980,8 @@ interface WriteFileOptions {
append?: boolean;
/** Sets the option to allow creating a new file, if one doesn't already exist at the specified path (defaults to `true`). */
create?: boolean;
/** Sets the option to create a new file, failing if it already exists. */
createNew?: boolean;
/** File permissions. Ignored on Windows. */
mode?: number;
/** Base directory for `path` */
@@ -1023,7 +1025,7 @@ async function writeFile(
*
* await writeTextFile('file.txt', "Hello world", { dir: BaseDirectory.App });
* ```
*
*
* @since 2.0.0
*/
async function writeTextFile(