mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 05:35:33 +00:00
feat: add Deno.osName() (#5714)
This commit is contained in:
parent
818a801092
commit
6ccf9037a6
8 changed files with 49 additions and 12 deletions
|
@ -53,7 +53,7 @@ export {
|
|||
export { metrics, Metrics } from "./ops/runtime.ts";
|
||||
export { mkdirSync, mkdir, MkdirOptions } from "./ops/fs/mkdir.ts";
|
||||
export { connect, listen, Listener, Conn } from "./net.ts";
|
||||
export { env, exit, execPath } from "./ops/os.ts";
|
||||
export { dir, env, exit, execPath, osName } from "./ops/os.ts";
|
||||
export { run, RunOptions, Process, ProcessStatus } from "./process.ts";
|
||||
export { DirEntry, readDirSync, readDir } from "./ops/fs/read_dir.ts";
|
||||
export { readFileSync, readFile } from "./read_file.ts";
|
||||
|
|
12
cli/js/lib.deno.unstable.d.ts
vendored
12
cli/js/lib.deno.unstable.d.ts
vendored
|
@ -32,6 +32,18 @@ declare namespace Deno {
|
|||
* Requires `allow-read` and `allow-write` permissions. */
|
||||
export function linkSync(oldpath: string, newpath: string): void;
|
||||
|
||||
/**
|
||||
* Returns the os name.
|
||||
*
|
||||
* ```ts
|
||||
* console.log(Deno.osName()); // e.g. "Linux"
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
|
||||
export function osName(): string;
|
||||
|
||||
/** Creates `newpath` as a hard link to `oldpath`.
|
||||
/** **UNSTABLE**: This API needs a security review.
|
||||
*
|
||||
* Creates `newpath` as a hard link to `oldpath`.
|
||||
|
|
|
@ -72,3 +72,7 @@ export function dir(kind: DirKind): string | null {
|
|||
export function execPath(): string {
|
||||
return sendSync("op_exec_path");
|
||||
}
|
||||
|
||||
export function osName(): string {
|
||||
return sendSync("op_name");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue