Deno.fsync

\color{red}{function} Deno.fsync(rid: number) : Promise<void>

\color{red}{作用}

将给定文件流的所有未决数据和元数据操作刷新到磁盘。

Flushes any pending data and metadata operations of the given file stream to disk.

\color{red}{参数}

rid : number

rid : number

\color{red}{返回值}

Promise<void>

Promise<void>

\color{red}{示列代码}

const file = await Deno.open("my_file.txt", { read: true, write: true, create: true });
await Deno.write(file.rid, new TextEncoder().encode("Hello World"));
await Deno.ftruncate(file.rid, 1);
await Deno.fsync(file.rid);
console.log(new TextDecoder().decode(await Deno.readFile("my_file.txt"))); // H

\color{red}{其它}

No

原文地址:点此跳转

Deno 目录

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

推荐阅读更多精彩内容

  • Deno.fdatasync(rid: number) : Promise<void> 将给定文件流的所有未决数据...
    小白本菜阅读 140评论 0 0
  • Deno.close (rid: number): void 通过 rid 关闭先前已打开的资源.例如通过打开或创...
    小白本菜阅读 155评论 0 0
  • Deno.chmodSync (path: string | URL, mode: number): void 同...
    小白本菜阅读 262评论 0 0
  • Deno.fsyncSync(rid: number) : void 将给定文件流的所有未决数据和元数据操作同步刷...
    小白本菜阅读 192评论 0 0
  • Deno.chdir (directory: string): void 将当前工作目录更改为指定的路径. 原文:...
    小白本菜阅读 207评论 0 0