BREAKING CHANGE: remove Deno.OpenMode (#4884)

This commit removes Deno.OpenMode along with overloaded variants
of Deno.open() and Deno.openSync() that used OpenMode.
This commit is contained in:
Bartek Iwańczuk 2020-04-25 00:45:55 +02:00 committed by GitHub
parent 0cb1bb98cc
commit 4a8d25646a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 113 additions and 198 deletions

View file

@ -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 &&