summaryrefslogtreecommitdiff
path: root/js/chown.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/chown.ts')
-rw-r--r--js/chown.ts18
1 files changed, 4 insertions, 14 deletions
diff --git a/js/chown.ts b/js/chown.ts
index 8787033fc..6bfddab98 100644
--- a/js/chown.ts
+++ b/js/chown.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,
- uid: number,
- gid: number
-): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] {
- const builder = flatbuffers.createBuilder();
- const path_ = builder.createString(path);
- const inner = msg.Chown.createChown(builder, path_, uid, gid);
- return [builder, msg.Any.Chown, inner];
-}
+import { sendSync, sendAsync } from "./dispatch_json";
+import * as dispatch from "./dispatch";
/**
* Change owner of a regular file or directory synchronously. Unix only at the moment.
@@ -19,7 +9,7 @@ function req(
* @param gid group id of the new owner
*/
export function chownSync(path: string, uid: number, gid: number): void {
- sendSync(...req(path, uid, gid));
+ sendSync(dispatch.OP_CHOWN, { path, uid, gid });
}
/**
@@ -33,5 +23,5 @@ export async function chown(
uid: number,
gid: number
): Promise<void> {
- await sendAsync(...req(path, uid, gid));
+ await sendAsync(dispatch.OP_CHOWN, { path, uid, gid });
}