summaryrefslogtreecommitdiff
path: root/js/chmod.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/chmod.ts')
-rw-r--r--js/chmod.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/js/chmod.ts b/js/chmod.ts
index 2a9b1b01d..3b14ef5bc 100644
--- a/js/chmod.ts
+++ b/js/chmod.ts
@@ -3,6 +3,19 @@ import * as msg from "gen/msg_generated";
import * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
+function req(
+ path: string,
+ mode: number
+): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] {
+ const builder = flatbuffers.createBuilder();
+ const path_ = builder.createString(path);
+ msg.Chmod.startChmod(builder);
+ msg.Chmod.addPath(builder, path_);
+ msg.Chmod.addMode(builder, mode);
+ const inner = msg.Chmod.endChmod(builder);
+ return [builder, msg.Any.Chmod, inner];
+}
+
/** Changes the permission of a specific file/directory of specified path
* synchronously.
*
@@ -19,16 +32,3 @@ export function chmodSync(path: string, mode: number): void {
export async function chmod(path: string, mode: number): Promise<void> {
await dispatch.sendAsync(...req(path, mode));
}
-
-function req(
- path: string,
- mode: number
-): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] {
- const builder = flatbuffers.createBuilder();
- const path_ = builder.createString(path);
- msg.Chmod.startChmod(builder);
- msg.Chmod.addPath(builder, path_);
- msg.Chmod.addMode(builder, mode);
- const inner = msg.Chmod.endChmod(builder);
- return [builder, msg.Any.Chmod, inner];
-}