readTextFile method

Future<String> readTextFile(
  1. Object path, [
  2. ReadFileOptions? options
])

Asynchronously reads and returns the entire contents of a file as an UTF-8 decoded string. Reading a directory throws an error.

const data = await Deno.readTextFile("hello.txt");
console.log(data);

Requires allow-read permission.

Implementation

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