ku4es-ui-data

kodmunki Utilities for ECMAScript UI Data

Usage no npm install needed!

<script type="module">
  import ku4esUiData from 'https://cdn.skypack.dev/ku4es-ui-data';
</script>

README

Classes

BinaryFile

Functions

createBlobFromBinaryArray(binaryArray, mimeType)Blob
createBlobFromDataUrl(dataUrl)Blob
readExifDataInDataUrl(dataUrl)Object | Object
blobFromSrc(src, [options])Promise.<Blob>
dataUrlFromSrc(src, [options])Promise.<string>
dataUrlFromFile(file, [options])Promise.<string>
blobFromFile(file, [options])Promise.<Blob>

BinaryFile

Kind: global class
Summary: A binary file abstraction that exposes methods for reading data from a binary file.

new BinaryFile(byteString)

Param
byteString

binaryFile.toBlob(mimeType) ⇒ Blob

Kind: instance method of BinaryFile
Access: public

Param Type Description
mimeType string A valid MIMEType

BinaryFile.parseDataUrl(dataUrl) ⇒ BinaryFile

Kind: static method of BinaryFile
Access: public

Param
dataUrl

createBlobFromBinaryArray(binaryArray, mimeType) ⇒ Blob

Kind: global function
Summary: Creates a Blob from a binary array, e.g. Uint16Array

Param Type
binaryArray TypedArray
mimeType string

createBlobFromDataUrl(dataUrl) ⇒ Blob

Kind: global function
Summary: Creates a blob from a dataURL

Param Type
dataUrl string

readExifDataInDataUrl(dataUrl) ⇒ Object | Object

Kind: global function
Summary: Reads exif data out of a dataURL

Param Type
dataUrl string

blobFromSrc(src, [options]) ⇒ Promise.<Blob>

Kind: global function
Summary: Convert an image at src url to blob

Param Type Description
src string path to target image or dataURL
[options] Object
[options.crossOrigin] boolean Set to true to support cross origin sources.
[options.mimeType] string A valid MIME type.
[options.maxAttempts] number The maximum number of attempts to convert before timeout.
[options.resolution] number
[options.resolution.x] number Pixel dimension resolution on the x-axis.
[options.resolution.y] number Pixel dimension resolution on the y-axis.
[options.orientation] number Current orientation. A number 1-8 following EXIF Orientation rules.

dataUrlFromSrc(src, [options]) ⇒ Promise.<string>

Kind: global function
Summary: Convert an image at src url to a dataURL

Param Type Description
src string path to target image
[options] Object
[options.crossOrigin] boolean Set to true to support cross origin sources.
[options.mimeType] string A valid MIME type.
[options.maxAttempts] number The maximum number of attempts to convert before timeout.
[options.resolution] number
[options.resolution.x] number Pixel dimension resolution on the x-axis.
[options.resolution.y] number Pixel dimension resolution on the y-axis.
[options.orientation] number Current orientation. A number 1-8 following EXIF Orientation rules.

dataUrlFromFile(file, [options]) ⇒ Promise.<string>

Kind: global function
Summary: Convert an image file to a dataURL

Param Type Description
file File File to convert
[options] Object
[options.crossOrigin] boolean Set to true to support cross origin sources.
[options.mimeType] string A valid MIME type.
[options.maxAttempts] number The maximum number of attempts to convert before timeout.
[options.resolution] number
[options.resolution.x] number Pixel dimension resolution on the x-axis.
[options.resolution.y] number Pixel dimension resolution on the y-axis.
[options.orientation] number Current orientation. A number 1-8 following EXIF Orientation rules.

blobFromFile(file, [options]) ⇒ Promise.<Blob>

Kind: global function
Summary: Convert an image file to a Blob

Param Type Description
file File File to convert
[options] Object
[options.crossOrigin] boolean Set to true to support cross origin sources.
[options.mimeType] string A valid MIME type.
[options.maxAttempts] number The maximum number of attempts to convert before timeout.
[options.resolution] number
[options.resolution.x] number Pixel dimension resolution on the x-axis.
[options.resolution.y] number Pixel dimension resolution on the y-axis.
[options.orientation] number Current orientation. A number 1-8 following EXIF Orientation rules.