Function: dataUrlBytes()
dataUrlBytes(
url):object
Defined in: src/lib/rendering/BrushTip/index.ts:35
The bytes and media type in a data: URL, read without fetch() (which the site's Content Security Policy doesn't
allow for data: URLs). Throws for anything that isn't a data: URL.
Parameters
url
string
Returns
object
bytes
bytes:
Uint8Array<ArrayBuffer>
type
type:
string
Example
dataUrlBytes("data:image/png;base64,iVBO..."); // { type: "image/png", bytes: Uint8Array [137, 80, 78, 71, ...] }
dataUrlBytes("data:text/plain,a%20b"); // { type: "text/plain", bytes: Uint8Array [97, 32, 98] }