Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/reader.ts>readAsObjectURL

A JavaScript extension package for building strong and modern applications.
Latest
function readAsObjectURL
import { readAsObjectURL } from "https://deno.land/x/ayonli_jsext@v0.9.72/reader.ts";

Reads all data from the given source to an object URL.

Examples

Example 1

import { readAsObjectURL } from "@ayonli/jsext/reader";

const file = new File(["Hello, World!"], "hello.txt", { type: "text/plain" });
const objectURL = await readAsObjectURL(file, file.type);

console.log(objectURL); // e.g. blob:http://localhost:8080/7b8e7b7d-7b7d-7b7d-7b7d-7b7d7b7d7b7d

Parameters

source:
| Blob
| ArrayBuffer
| ArrayBufferView
| AsyncIterable<Uint8Array>
| ReadableStream<Uint8Array>
type: string

Returns

Promise<string>