summaryrefslogtreecommitdiff
path: root/std/fs
diff options
context:
space:
mode:
Diffstat (limited to 'std/fs')
-rw-r--r--std/fs/README.md15
-rw-r--r--std/fs/read_file_str.ts33
-rw-r--r--std/fs/read_file_str_test.ts19
3 files changed, 0 insertions, 67 deletions
diff --git a/std/fs/README.md b/std/fs/README.md
index dd1692524..aad81acee 100644
--- a/std/fs/README.md
+++ b/std/fs/README.md
@@ -168,21 +168,6 @@ async function printFilesNames() {
printFilesNames().then(() => console.log("Done!"));
```
-### readFileStr
-
-Read file and output it as a string.
-
-**ReadOptions**
-
-- encoding : The encoding to read file. lowercased.
-
-```ts
-import { readFileStr, readFileStrSync } from "https://deno.land/std/fs/mod.ts";
-
-readFileStr("./target.dat", { encoding: "utf8" }); // returns a promise
-readFileStrSync("./target.dat", { encoding: "utf8" }); // string
-```
-
### expandGlob
Expand the glob string from the specified `root` directory and yield each result
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));
-}
diff --git a/std/fs/read_file_str_test.ts b/std/fs/read_file_str_test.ts
deleted file mode 100644
index 0671d8b92..000000000
--- a/std/fs/read_file_str_test.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { assert } from "../testing/asserts.ts";
-import * as path from "../path/mod.ts";
-import { readFileStrSync, readFileStr } from "./read_file_str.ts";
-
-const testdataDir = path.resolve("fs", "testdata");
-
-Deno.test("testReadFileSync", function (): void {
- const jsonFile = path.join(testdataDir, "json_valid_obj.json");
- const strFile = readFileStrSync(jsonFile);
- assert(typeof strFile === "string");
- assert(strFile.length > 0);
-});
-
-Deno.test("testReadFile", async function (): Promise<void> {
- const jsonFile = path.join(testdataDir, "json_valid_obj.json");
- const strFile = await readFileStr(jsonFile);
- assert(typeof strFile === "string");
- assert(strFile.length > 0);
-});