@oazmi/kitchensink - v0.9.13

    Function readTextFile

    • reads and returns text data from a file on supported runtimes (i.e. RUNTIME.DENO, RUNTIME.BUN, or RUNTIME.NODE). for unsupported runtimes, an error is thrown.

      Parameters

      • runtime_enum: RUNTIME

        the runtime enum indicating which runtime should be used for reading the filesystem.

      • file_path: string | URL

        the source file path to read from.

      • config: Partial<ReadFileConfig> = {}

        provide optional configuration on how the reading should be performed.

      Returns Promise<string>

      an error is thrown if an unsupported runtime uses this function.

      import { assertStringIncludes } from "jsr:@std/assert"

      const my_deno_json = await readTextFile(identifyCurrentRuntime(), new URL(import.meta.resolve("../deno.json")))
      assertStringIncludes(my_deno_json, `"name": "@oazmi/kitchensink"`)
    MMNEPVFCICPMFPCPTTAAATR