open method

Future<FsFile> open(
  1. Object path, [
  2. OpenOptions? options
])

Open a file and resolve to an instance of {@linkcode Deno.FsFile}. The file does not need to previously exist if using the create or createNew open options. It is the caller's responsibility to close the file when finished with it.

const file = await Deno.open("/foo/bar.txt", { read: true, write: true });
// Do work with file
file.close();

Requires allow-read and/or allow-write permissions depending on options.

Implementation

_i2.Future<_i4.FsFile> open(
  _i2.Object path, [
  _i4.OpenOptions? options,
]) =>
    _i3.promiseToFuture(_i3.callMethod(
      this,
      'open',
      [
        path,
        options ?? _i6.undefined,
      ],
    ));