summaryrefslogtreecommitdiff
path: root/cli/js/ops/fs/read_dir.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/ops/fs/read_dir.ts')
-rw-r--r--cli/js/ops/fs/read_dir.ts34
1 files changed, 0 insertions, 34 deletions
diff --git a/cli/js/ops/fs/read_dir.ts b/cli/js/ops/fs/read_dir.ts
deleted file mode 100644
index 6ffe6116e..000000000
--- a/cli/js/ops/fs/read_dir.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-
-import { sendSync, sendAsync } from "../dispatch_json.ts";
-import { pathFromURL } from "../../util.ts";
-
-export interface DirEntry {
- name: string;
- isFile: boolean;
- isDirectory: boolean;
- isSymlink: boolean;
-}
-
-interface ReadDirResponse {
- entries: DirEntry[];
-}
-
-function res(response: ReadDirResponse): DirEntry[] {
- return response.entries;
-}
-
-export function readDirSync(path: string | URL): Iterable<DirEntry> {
- return res(sendSync("op_read_dir", { path: pathFromURL(path) }))[
- Symbol.iterator
- ]();
-}
-
-export function readDir(path: string | URL): AsyncIterable<DirEntry> {
- const array = sendAsync("op_read_dir", { path: pathFromURL(path) }).then(res);
- return {
- async *[Symbol.asyncIterator](): AsyncIterableIterator<DirEntry> {
- yield* await array;
- },
- };
-}