writes binary/buffer data to a file on supported runtimes (i.e. RUNTIME.DENO, RUNTIME.BUN, or RUNTIME.NODE). for unsupported runtimes, an error is thrown.

an error is thrown if an unsupported runtime uses this function, or if config.create is false, and no pre-existing file resides at the specified file_path.

  • Parameters

    • runtime_enum: RUNTIME

      the runtime enum indicating which runtime should be used for writing onto the filesystem.

    • file_path: string | URL

      the destination file path.

    • data: ArrayBufferView

      the byte/buffer data to write to the file.

    • config: Partial<WriteFileConfig> = {}

      provide optional configuration on how the writing should be performed.

    Returns Promise<void>