$k. Blob

new Blob()

The value of a blob attribute.

Methods

base64String() → {string}

Returns the blob bytes as base 64 encoded string

Returns:
Type: 
string

charset() → {string}

Returns the charset of the blob

Since
  • 5.1.0
Returns:
Type: 
string

convertImage(mediaType) → {$k.NetEntity}

Converts the image to another media type

Parameters:
NameTypeDescription
mediaTypestring

The media type of the converted image

Throws:

If the image could not be converted

Type
$k.exception.InvalidValue
Returns:

The converted image

Type: 
$k.NetEntity

createThumbnail(width, height, mediaTypeopt) → {$k.NetEntity}

Create a thumbnail with the specified maxium dimensions. The aspect ratio is preserved. Width or height can be undefined, but not both. The media type is optional and specifies the image type of the thumbnail. If not defined, the thumbnail will have the same type as the original image.

Parameters:
NameTypeAttributesDescription
widthnumber

The maximum width of the thumbnail

heightnumber

The maximum height of the thumbnail

mediaTypestring<optional>

The media type of the converted image

Throws:

If the image could not be converted

Type
$k.exception.InvalidValue
Returns:

The converted image

Type: 
$k.NetEntity

dataUrl() → {string}

Returns the blob bytes as a data URL

Returns:
Type: 
string

equals(value) → {boolean}

Returns true if the values are equal

Parameters:
NameTypeDescription
value

Another attribute value

Returns:
Type: 
boolean

fileExtension() → {string}

Returns the extension of the filename of the blob, without dot

Returns:
Type: 
string

fileId() → {number}

Returns the file identifiert of the blob, which will change when the file contents change

Since
  • 5.4.2
Returns:
Type: 
number

filename() → {string}

Returns the filename of the blob

Returns:
Type: 
string

imageDimensions() → {array}

Returns the image dimensions in pixels as array.

Throws:

If the blob is no image.

Type
$k.exception.InvalidValue
Returns:

Array containing width as first and height as second element.

Type: 
array

language() → {string}

Returns the language of the blob, or undefined if not translated

Returns:
Type: 
string

locator() → {string}

Returns a string that identifies the blob. Can be used to get the blob contents from the blob REST service. Returns undefined if the blob is not stored as the value of an attribute yet.

Returns:
Type: 
string

mimeType() → {string}

Returns the mime type of the blob

Returns:
Type: 
string

setBase64String(string) → {blob}

Set the blob bytes from base 64 encoded string

Parameters:
NameTypeDescription
stringstring

A base 64 encoded string

Since
  • 4.1.0
Returns:
Type: 
blob

setCharset(string) → {blob}

Set the charset of the blob

Parameters:
NameTypeDescription
stringstring
Since
  • 5.1.0
Returns:
Type: 
blob

setFilename(string) → {blob}

Set the filename of the blob

Parameters:
NameTypeDescription
stringstring
Since
  • 4.1.0
Returns:
Type: 
blob

setMimeType(string) → {blob}

Set the mime type of the blob

Parameters:
NameTypeDescription
stringstring
Since
  • 4.1.0
Returns:
Type: 
blob

size() → {number}

Returns the byte size of the blob

Returns:
Type: 
number

text(charsetopt) → {string}

Returns the blob bytes as string

Parameters:
NameTypeAttributesDescription
charsetstring<optional>

Charset of the characters. UTF-8 if undefined

Returns:
Type: 
string

toNetEntity() → {$k.NetEntity}

Creates a NetEntity from this blob

Returns:
Type: 
$k.NetEntity