阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Deno.open

      open

      • open(path: string, options?: OpenOptions): Promise<File>

      • open(path: string, openMode?: OpenMode): Promise<File>

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

        Open a file and resolve to 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 = await Deno.open("/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)
      

      返回 Promise<File>

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

        Open a file and resolve to 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 = await Deno.open("/foo/bar.txt", "w+");
          // 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)
      

      返回 Promise<File>

      目录
      本文目录
      目录