summaryrefslogtreecommitdiff
path: root/js/mkdir.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/mkdir.ts')
-rw-r--r--js/mkdir.ts18
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 });
}