summaryrefslogtreecommitdiff
path: root/js/os.ts
diff options
context:
space:
mode:
authorSajjad Hashemian <wolaws@gmail.com>2018-08-26 10:56:30 +0430
committerRyan Dahl <ry@tinyclouds.org>2018-09-03 15:06:00 -0400
commitb2b4299e3b499c50bd11059854e3dcb4df2e2891 (patch)
tree832852af526023863cd655231689031bcd6777eb /js/os.ts
parentdff909ef6c1f5ce8b08f9cb7fa0fb7bf4d60a086 (diff)
Implement mkdirSync
Diffstat (limited to 'js/os.ts')
-rw-r--r--js/os.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/js/os.ts b/js/os.ts
index e669aea9d..cca121874 100644
--- a/js/os.ts
+++ b/js/os.ts
@@ -104,6 +104,25 @@ export function makeTempDirSync({
return path!;
}
+// mkdir creates a new directory with the specified name
+// and permission bits (before umask).
+export function mkdirSync(path: string, mode = 0o777): void {
+ /* Ideally we could write:
+ const res = send({
+ command: fbs.Command.MKDIR_SYNC,
+ mkdirSyncPath: path,
+ mkdirSyncMode: mode,
+ });
+ */
+ const builder = new flatbuffers.Builder();
+ const path_ = builder.createString(path);
+ fbs.MkdirSync.startMkdirSync(builder);
+ fbs.MkdirSync.addPath(builder, path_);
+ fbs.MkdirSync.addMode(builder, mode);
+ const msg = fbs.MkdirSync.endMkdirSync(builder);
+ send(builder, fbs.Any.MkdirSync, msg);
+}
+
export function readFileSync(filename: string): Uint8Array {
/* Ideally we could write
const res = send({