write method
Write to the resource ID (rid
) the contents of the array buffer (data
).
Resolves to the number of bytes written. This function is one of the lowest level APIs and most users should not work with this directly, but rather use {@linkcode WritableStream}, {@linkcode ReadableStream.from} and {@linkcode ReadableStream.pipeTo}.
It is not guaranteed that the full buffer will be written in a single call.
const encoder = new TextEncoder();
const data = encoder.encode("Hello world");
const file = await Deno.open("/foo/bar.txt", { write: true });
const bytesWritten = await Deno.write(file.rid, data); // 11
Deno.close(file.rid);
Implementation
_i2.Future<_i2.num> write(
_i2.num rid,
_i9.Uint8List data,
) =>
_i3.promiseToFuture(_i3.callMethod(
this,
'write',
[
rid,
data,
],
));