diff --git a/fs/read_file.ts b/fs/read_file_str.ts similarity index 83% rename from fs/read_file.ts rename to fs/read_file_str.ts index 50de2fcea884..9f87c933892d 100644 --- a/fs/read_file.ts +++ b/fs/read_file_str.ts @@ -10,7 +10,10 @@ export interface ReadOptions { * @param filename File to read * @param opts Read options */ -export function readFileSync(filename: string, opts: ReadOptions = {}): string { +export function readFileStrSync( + filename: string, + opts: ReadOptions = {} +): string { const decoder = new TextDecoder(opts.encoding); return decoder.decode(Deno.readFileSync(filename)); } @@ -21,7 +24,7 @@ export function readFileSync(filename: string, opts: ReadOptions = {}): string { * @param filename File to read * @param opts Read options */ -export async function readFile( +export async function readFileStr( filename: string, opts: ReadOptions = {} ): Promise { diff --git a/fs/read_file_test.ts b/fs/read_file_str_test.ts similarity index 77% rename from fs/read_file_test.ts rename to fs/read_file_str_test.ts index da48b9f647cb..eb529022c5e5 100644 --- a/fs/read_file_test.ts +++ b/fs/read_file_str_test.ts @@ -1,20 +1,20 @@ import { test } from "../testing/mod.ts"; import { assert } from "../testing/asserts.ts"; -import { readFileSync, readFile } from "./read_file.ts"; +import { readFileStrSync, readFileStr } from "./read_file_str.ts"; import * as path from "./path/mod.ts"; const testdataDir = path.resolve("fs", "testdata"); test(function testReadFileSync() { const jsonFile = path.join(testdataDir, "json_valid_obj.json"); - const strFile = readFileSync(jsonFile); + const strFile = readFileStrSync(jsonFile); assert(typeof strFile === "string"); assert(strFile.length > 0); }); test(async function testReadFile() { const jsonFile = path.join(testdataDir, "json_valid_obj.json"); - const strFile = await readFile(jsonFile); + const strFile = await readFileStr(jsonFile); assert(typeof strFile === "string"); assert(strFile.length > 0); });