-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
port cli/ops/fs.rs to json ops, part 1
- Loading branch information
1 parent
137f337
commit f3c7834
Showing
9 changed files
with
107 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,20 @@ | ||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. | ||
import { sendSync, sendAsync, msg, flatbuffers } from "./dispatch_flatbuffers"; | ||
|
||
function req( | ||
path: string, | ||
mode: number | ||
): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] { | ||
const builder = flatbuffers.createBuilder(); | ||
const path_ = builder.createString(path); | ||
const inner = msg.Chmod.createChmod(builder, path_, mode); | ||
return [builder, msg.Any.Chmod, inner]; | ||
} | ||
import { sendSync, sendAsync } from "./dispatch_json"; | ||
import * as dispatch from "./dispatch"; | ||
|
||
/** Changes the permission of a specific file/directory of specified path | ||
* synchronously. | ||
* | ||
* Deno.chmodSync("/path/to/file", 0o666); | ||
*/ | ||
export function chmodSync(path: string, mode: number): void { | ||
sendSync(...req(path, mode)); | ||
sendSync(dispatch.OP_CHMOD, { path, mode }); | ||
} | ||
|
||
/** Changes the permission of a specific file/directory of specified path. | ||
* | ||
* await Deno.chmod("/path/to/file", 0o666); | ||
*/ | ||
export async function chmod(path: string, mode: number): Promise<void> { | ||
await sendAsync(...req(path, mode)); | ||
await sendAsync(dispatch.OP_CHMOD, { path, mode }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.