From 4a8d25646aa58e3e59d622e69c41822b40415c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sat, 25 Apr 2020 00:45:55 +0200 Subject: BREAKING CHANGE: remove Deno.OpenMode (#4884) This commit removes Deno.OpenMode along with overloaded variants of Deno.open() and Deno.openSync() that used OpenMode. --- cli/js/write_file.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'cli/js/write_file.ts') 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 && -- cgit v1.2.3