summaryrefslogtreecommitdiff
path: root/js/chmod.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/chmod.ts')
-rw-r--r--js/chmod.ts17
1 files changed, 4 insertions, 13 deletions
diff --git a/js/chmod.ts b/js/chmod.ts
index 2d6a5ed0f..23b3dff25 100644
--- a/js/chmod.ts
+++ b/js/chmod.ts
@@ -1,15 +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,
- mode: number
-): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] {
- const builder = flatbuffers.createBuilder();
- const path_ = builder.createString(path);
- const inner = msg.Chmod.createChmod(builder, path_, mode);
- return [builder, msg.Any.Chmod, inner];
-}
+import { sendSync, sendAsync } from "./dispatch_json";
+import * as dispatch from "./dispatch";
/** Changes the permission of a specific file/directory of specified path
* synchronously.
@@ -17,7 +8,7 @@ function req(
* Deno.chmodSync("/path/to/file", 0o666);
*/
export function chmodSync(path: string, mode: number): void {
- sendSync(...req(path, mode));
+ sendSync(dispatch.OP_CHMOD, { path, mode });
}
/** Changes the permission of a specific file/directory of specified path.
@@ -25,5 +16,5 @@ export function chmodSync(path: string, mode: number): void {
* await Deno.chmod("/path/to/file", 0o666);
*/
export async function chmod(path: string, mode: number): Promise<void> {
- await sendAsync(...req(path, mode));
+ await sendAsync(dispatch.OP_CHMOD, { path, mode });
}