diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-04-25 00:45:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-25 00:45:55 +0200 |
commit | 4a8d25646aa58e3e59d622e69c41822b40415c46 (patch) | |
tree | e228581912bfc0a4bdb56e3caec2ca3a1c1b9087 /cli/js/write_file.ts | |
parent | 0cb1bb98cc2de8dfe51b7adbe992666936146c90 (diff) |
BREAKING CHANGE: remove Deno.OpenMode (#4884)
This commit removes Deno.OpenMode along with overloaded variants
of Deno.open() and Deno.openSync() that used OpenMode.
Diffstat (limited to 'cli/js/write_file.ts')
-rw-r--r-- | cli/js/write_file.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cli/js/write_file.ts b/cli/js/write_file.ts index ed64141d2..af3f67251 100644 --- a/cli/js/write_file.ts +++ b/cli/js/write_file.ts @@ -24,8 +24,10 @@ export function writeFileSync( } } - const openMode = !!options.append ? "a" : "w"; - const file = openSync(path, openMode); + const openOptions = !!options.append + ? { write: true, create: true, append: true } + : { write: true, create: true, truncate: true }; + const file = openSync(path, openOptions); if ( options.mode !== undefined && @@ -52,8 +54,10 @@ export async function writeFile( } } - const openMode = !!options.append ? "a" : "w"; - const file = await open(path, openMode); + const openOptions = !!options.append + ? { write: true, create: true, append: true } + : { write: true, create: true, truncate: true }; + const file = await open(path, openOptions); if ( options.mode !== undefined && |