write method

Future<num> write(
  1. Uint8List p
)

Write the contents of the array buffer (p) to the file.

Resolves to the number of bytes written.

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 file.write(data); // 11
file.close();

@category I/O

Implementation

_i2.Future<_i2.num> write(_i9.Uint8List p) =>
    _i3.promiseToFuture(_i3.callMethod(
      this,
      'write',
      [p],
    ));