diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-07-23 10:18:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-22 22:18:18 -0400 |
commit | fd900cfe215e919392941b39b57a16b4a9976eec (patch) | |
tree | 93f7a04e17a5a3492bb4202e620f0cb4e6f35a4e /std/fs/read_file_str.ts | |
parent | 843b54549c04337f18c62d1daf159a79865de6b7 (diff) |
BREAKING(std/fs): remove readFileStr and readFileStrSync (#6848)
This removes the readFileStr and readFileStrSync functions which are
effectively duplicates of Deno.readTextFile and Deno.readTextFileSync.
Diffstat (limited to 'std/fs/read_file_str.ts')
-rw-r--r-- | std/fs/read_file_str.ts | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/std/fs/read_file_str.ts b/std/fs/read_file_str.ts deleted file mode 100644 index 9aa50f15a..000000000 --- a/std/fs/read_file_str.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -export interface ReadOptions { - encoding?: string; -} - -/** - * Read file synchronously and output it as a string. - * - * @param filename File to read - * @param opts Read options - */ -export function readFileStrSync( - filename: string, - opts: ReadOptions = {}, -): string { - const decoder = new TextDecoder(opts.encoding); - return decoder.decode(Deno.readFileSync(filename)); -} - -/** - * Read file and output it as a string. - * - * @param filename File to read - * @param opts Read options - */ -export async function readFileStr( - filename: string, - opts: ReadOptions = {}, -): Promise<string> { - const decoder = new TextDecoder(opts.encoding); - return decoder.decode(await Deno.readFile(filename)); -} |