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/chown.ts | |
parent | 520f9631e09aa720fd8c03513ee8ea967f5ed4b2 (diff) |
port fs ops to JSON (#2812)
Diffstat (limited to 'js/chown.ts')
-rw-r--r-- | js/chown.ts | 18 |
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 }); } |