From fd900cfe215e919392941b39b57a16b4a9976eec Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Thu, 23 Jul 2020 10:18:18 +0800 Subject: 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. --- std/fs/read_file_str.ts | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 std/fs/read_file_str.ts (limited to 'std/fs/read_file_str.ts') 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 { - const decoder = new TextDecoder(opts.encoding); - return decoder.decode(await Deno.readFile(filename)); -} -- cgit v1.2.3