diff options
author | Stanislav <62983943+stanislavstrelnikov@users.noreply.github.com> | 2020-07-07 04:45:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-06 21:45:39 -0400 |
commit | 158ae0bfe900d2bac3076390c4fe3d2b54d94fe5 (patch) | |
tree | 209e4b5682e2a899041767c49428e34329e48084 /cli/js/write_text_file.ts | |
parent | ab4c574f5202f607ceb6068f56b3cc8aed1bbbaf (diff) |
clean up code in cli/js (#6611)
Diffstat (limited to 'cli/js/write_text_file.ts')
-rw-r--r-- | cli/js/write_text_file.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cli/js/write_text_file.ts b/cli/js/write_text_file.ts index 4f111edb4..615813460 100644 --- a/cli/js/write_text_file.ts +++ b/cli/js/write_text_file.ts @@ -1,10 +1,12 @@ +// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. + import { open, openSync } from "./files.ts"; import { writeAll, writeAllSync } from "./buffer.ts"; export function writeTextFileSync(path: string | URL, data: string): void { const file = openSync(path, { write: true, create: true, truncate: true }); - const enc = new TextEncoder(); - const contents = enc.encode(data); + const encoder = new TextEncoder(); + const contents = encoder.encode(data); writeAllSync(file, contents); file.close(); } @@ -14,8 +16,8 @@ export async function writeTextFile( data: string ): Promise<void> { const file = await open(path, { write: true, create: true, truncate: true }); - const enc = new TextEncoder(); - const contents = enc.encode(data); + const encoder = new TextEncoder(); + const contents = encoder.encode(data); await writeAll(file, contents); file.close(); } |