Console ↗

image()

Convert a Uint8Array or Node Buffer to a JSON image asset. Specify jpg or png to match the bytes.

Signature

image(bytes, format)

Example

import {readFile} from "node:fs/promises";
import {image} from "./ngila.mjs";
const value = image(await readFile("shelf.jpg"), "jpg");