Deno.writesync
🌙
手机阅读
本文目录结构
writeSync
-
writeSync(rid: number, data: Uint8Array): number
-
同步地将数组缓冲区 (
data
) 的内容写入资源 ID 的所属文件 (rid
) 。Synchronously write to the resource ID (
rid
) the contents of the array buffer (data
).返回写入的字节数。
Returns the number of bytes written.
const encoder = new TextEncoder(); const data = encoder.encode("Hello world"); const file = Deno.openSync("/foo/bar.txt"); const bytesWritten = Deno.writeSync(file.rid, data); // 11 Deno.close(file.rid);
参数
- ##### rid: number
- ##### data: Uint8Array