本文目录

Deno.opensync

🌙
手机阅读
本文目录结构

openSync

  • openSync(path: string, options?: OpenOptions): File

  • openSync(path: string, openMode?: OpenMode): File

  • 用同步方式打开一个文件并返回一个 Deno.File 实例。如果使用了 createcreateNew配置项 文件可以不需要预先存在。调用者应该在完成后关闭文件。

    Synchronously open a file and return an instance of Deno.File. The file does not need to previously exist if using the create or createNew open options. It is the callers responsibility to close the file when finished with it.

      const file = Deno.openSync("/foo/bar.txt", { read: true, write: true });
      // Do work with file
      Deno.close(file.rid);
    

    根据不同的配置需要相应的 allow-readallow-write 权限。

    Requires allow-read and/or allow-write permissions depending on options.

参数

-   ##### path: string

-   ##### Optional options: [OpenOptions](interfaces/deno.openoptions.html)

返回 File

  • 用同步方式打开一个文件并返回一个 Deno.File 实例。根据传入的模式,可以创建文件。 调用者应该在完成后关闭文件。

    Synchronously open a file and return an instance of Deno.File. The file may be created depending on the mode passed in. It is the callers responsibility to close the file when finished with it.

      const file = Deno.openSync("/foo/bar.txt", "r");
      // Do work with file
      Deno.close(file.rid);
    

    根据不同的打开模式需要相应的 allow-readallow-write 权限。

    Requires allow-read and/or allow-write permissions depending on openMode.

参数

-   ##### path: string

-   ##### Optional openMode: [OpenMode](index.html#openmode)

返回 File

AXIHE / 精选资源

浏览全部教程

面试题

学习网站

前端培训
自己甄别

前端书籍

关于朱安邦

我叫 朱安邦,阿西河的站长,在杭州。

以前是一名平面设计师,后来开始接接触前端开发,主要研究前端技术中的JS方向。

业余时间我喜欢分享和交流自己的技术,欢迎大家关注我的 Bilibili

关注我: Github / 知乎

于2021年离开前端领域,目前重心放在研究区块链上面了

我叫朱安邦,阿西河的站长

目前在杭州从事区块链周边的开发工作,机械专业,以前从事平面设计工作。

2014年底脱产在老家自学6个月的前端技术,自学期间几乎从未出过家门,最终找到了满意的前端工作。更多>

于2021年离开前端领域,目前从事区块链方面工作了