24 lines
475 B
TypeScript
24 lines
475 B
TypeScript
import { PngNodeType } from "../public/png/constants.js";
|
|
|
|
type Node<T> = {
|
|
/**
|
|
* The type of this node. Typically an enum specific to the format.
|
|
*/
|
|
type: T;
|
|
|
|
/**
|
|
* The bytes that make up this node.
|
|
*
|
|
* It is highly encouraged to use `Uint8Array.prototype.subarray`,
|
|
* not `.slice`, to avoid copying the data.
|
|
*/
|
|
bytes: Uint8Array;
|
|
|
|
/**
|
|
* Child nodes.
|
|
*/
|
|
children?: ReadonlyArray<Node<T>>;
|
|
};
|
|
|
|
export type PngNode = Node<PngNodeType>;
|