diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-08-26 16:18:42 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-08-26 10:18:42 -0400 |
commit | a6f6209f5277f2737bc67efad5c91ab168aff6b5 (patch) | |
tree | 88e8449e61e09cf5037def8d723ec43654d31b06 /js/mkdir.ts | |
parent | 520f9631e09aa720fd8c03513ee8ea967f5ed4b2 (diff) |
port fs ops to JSON (#2812)
Diffstat (limited to 'js/mkdir.ts')
-rw-r--r-- | js/mkdir.ts | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/js/mkdir.ts b/js/mkdir.ts index 417c754a9..54f99224b 100644 --- a/js/mkdir.ts +++ b/js/mkdir.ts @@ -1,16 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { sendSync, sendAsync, msg, flatbuffers } from "./dispatch_flatbuffers"; - -function req( - path: string, - recursive: boolean, - mode: number -): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] { - const builder = flatbuffers.createBuilder(); - const path_ = builder.createString(path); - const inner = msg.Mkdir.createMkdir(builder, path_, recursive, mode); - return [builder, msg.Any.Mkdir, inner]; -} +import { sendSync, sendAsync } from "./dispatch_json"; +import * as dispatch from "./dispatch"; /** Creates a new directory with the specified path synchronously. * If `recursive` is set to true, nested directories will be created (also known @@ -22,7 +12,7 @@ function req( * Deno.mkdirSync("nested/directories", true); */ export function mkdirSync(path: string, recursive = false, mode = 0o777): void { - sendSync(...req(path, recursive, mode)); + sendSync(dispatch.OP_MKDIR, { path, recursive, mode }); } /** Creates a new directory with the specified path. @@ -39,5 +29,5 @@ export async function mkdir( recursive = false, mode = 0o777 ): Promise<void> { - await sendAsync(...req(path, recursive, mode)); + await sendAsync(dispatch.OP_MKDIR, { path, recursive, mode }); } |