阿西河

所有教程

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

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      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

      目录
      本文目录
      目录