diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2019-03-10 04:30:38 +1100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-09 12:30:38 -0500 |
commit | 034e2cc02829c9244b32232074c7a48af827a2fb (patch) | |
tree | bade01606a1ee076c1f753ce99c97ddb1e4edf30 /js/read_file.ts | |
parent | 8c7a12d1b258f0ef5ab27f49c424331d43e8d97f (diff) |
Migrate from tslint to eslint for linting (#1905)
Diffstat (limited to 'js/read_file.ts')
-rw-r--r-- | js/read_file.ts | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/js/read_file.ts b/js/read_file.ts index 288841672..3aeedec28 100644 --- a/js/read_file.ts +++ b/js/read_file.ts @@ -4,26 +4,6 @@ import * as flatbuffers from "./flatbuffers"; import { assert } from "./util"; import * as dispatch from "./dispatch"; -/** Read the entire contents of a file synchronously. - * - * const decoder = new TextDecoder("utf-8"); - * const data = Deno.readFileSync("hello.txt"); - * console.log(decoder.decode(data)); - */ -export function readFileSync(filename: string): Uint8Array { - return res(dispatch.sendSync(...req(filename))); -} - -/** Read the entire contents of a file. - * - * const decoder = new TextDecoder("utf-8"); - * const data = await Deno.readFile("hello.txt"); - * console.log(decoder.decode(data)); - */ -export async function readFile(filename: string): Promise<Uint8Array> { - return res(await dispatch.sendAsync(...req(filename))); -} - function req( filename: string ): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] { @@ -44,3 +24,23 @@ function res(baseRes: null | msg.Base): Uint8Array { assert(dataArray != null); return new Uint8Array(dataArray!); } + +/** Read the entire contents of a file synchronously. + * + * const decoder = new TextDecoder("utf-8"); + * const data = Deno.readFileSync("hello.txt"); + * console.log(decoder.decode(data)); + */ +export function readFileSync(filename: string): Uint8Array { + return res(dispatch.sendSync(...req(filename))); +} + +/** Read the entire contents of a file. + * + * const decoder = new TextDecoder("utf-8"); + * const data = await Deno.readFile("hello.txt"); + * console.log(decoder.decode(data)); + */ +export async function readFile(filename: string): Promise<Uint8Array> { + return res(await dispatch.sendAsync(...req(filename))); +} |