diff options
Diffstat (limited to 'js/read_dir.ts')
-rw-r--r-- | js/read_dir.ts | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/js/read_dir.ts b/js/read_dir.ts index d7d20644b..2515a61c6 100644 --- a/js/read_dir.ts +++ b/js/read_dir.ts @@ -5,23 +5,6 @@ import * as dispatch from "./dispatch"; import { FileInfo, FileInfoImpl } from "./file_info"; import { assert } from "./util"; -/** Reads the directory given by path and returns a list of file info - * synchronously. - * - * const files = Deno.readDirSync("/"); - */ -export function readDirSync(path: string): FileInfo[] { - return res(dispatch.sendSync(...req(path))); -} - -/** Reads the directory given by path and returns a list of file info. - * - * const files = await Deno.readDir("/"); - */ -export async function readDir(path: string): Promise<FileInfo[]> { - return res(await dispatch.sendAsync(...req(path))); -} - function req(path: string): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] { const builder = flatbuffers.createBuilder(); const path_ = builder.createString(path); @@ -42,3 +25,20 @@ function res(baseRes: null | msg.Base): FileInfo[] { } return fileInfos; } + +/** Reads the directory given by path and returns a list of file info + * synchronously. + * + * const files = Deno.readDirSync("/"); + */ +export function readDirSync(path: string): FileInfo[] { + return res(dispatch.sendSync(...req(path))); +} + +/** Reads the directory given by path and returns a list of file info. + * + * const files = await Deno.readDir("/"); + */ +export async function readDir(path: string): Promise<FileInfo[]> { + return res(await dispatch.sendAsync(...req(path))); +} |