From a6f6209f5277f2737bc67efad5c91ab168aff6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 26 Aug 2019 16:18:42 +0200 Subject: port fs ops to JSON (#2812) --- js/chown.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'js/chown.ts') 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 { - await sendAsync(...req(path, uid, gid)); + await sendAsync(dispatch.OP_CHOWN, { path, uid, gid }); } -- cgit v1.2.3