Deno.chmod

\color{red}{function} Deno.chmod (path: string | URL, mode: number): Promise<void>

\color{red}{作用}

更改指定路径的特定文件/目录的权限。 忽略进程的umask值。

原文: Changes the permission of a specific file/directory of specified path. Ignores the process's umask.

\color{red}{参数}

路径 : 字符串 | URL
模式 : 数字

原文:
path : string | URL
mode : number

\color{red}{返回值}

Promise<void>

原文: Promise<void>

\color{red}{示列代码}

await Deno.chmod("/path/to/file", 0o666);

\color{red}{其它}

该模式是3个八进制数字的序列。
第一个(最左边的)数字指定所有者的权限。
第二个数字指定该组的权限。
最后(最右边)的数字指定其他用户的权限。
例如,在0o764模式下,所有者(7)可以读/写/执行,组(6)可以读/写,其他所有人(4)只能读。

数字 描述
7 读,写,执行
6 读和写
5 读和执行
4 只读
3 写和执行
2 只写
1 仅执行
0 没有许可(没有权限)

注意:此API当前在Windows上抛出
需要 allow-write 权限。

原文:
The mode is a sequence of 3 octal numbers.
The first/left-most number specifies the permissions for the owner.
The second number specifies the permissions for the group.
The last/right-most number specifies the permissions for others. For example, with a mode of 0o764, the owner (7) can read/write/execute, the group (6) can read/write and everyone else (4) can read only.

Number Description
7 read, write, and execute
6 read and write
5 read and execute
4 read only
3 write and execute
2 write only
1 execute only
0 no permission

NOTE: This API currently throws on Windows
Requires allow-write permission.

原文地址:点此跳转

Deno 目录

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容