Constructor
new Doc(valueopt)
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
value |
string | object |
<optional> |
Document name or value
Properties
|
Methods
getContent() → {string}
Returns:
Content
- Type
- string
getContentAsArrayBuffer() → {ArrayBuffer}
Returns:
Content as an array buffer
- Type
- ArrayBuffer
getContentAsText() → {string}
Returns:
Content as plain text
- Type
- string
getDataURL(thumbnailopt) → {string}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
thumbnail |
boolean |
<optional> |
false
|
Thumbnail? If thumbnail does not exists the content is used. |
Returns:
Data URL or nothing if content is empty
- Type
- string
getFileName() → {string}
Returns:
Name
- Type
- string
getFilename() → {string}
Returns:
Name
- Type
- string
getId() → {string}
Returns:
ID
- Type
- string
getMIMEType() → {string}
Returns:
MIME type
- Type
- string
getMimeType() → {string}
Returns:
MIME type
- Type
- string
getName() → {string}
Returns:
Name
- Type
- string
getThumbnail() → {string}
Returns:
Thumbnail
- Type
- string
getThumbnailAsArrayBuffer() → {ArrayBuffer}
Returns:
Thumbnail as an array buffer
- Type
- ArrayBuffer
getValue() → {object}
Returns:
Value object
- Type
- object
load(file) → {promise.<Doc>}
Parameters:
Name | Type | Description |
---|---|---|
file |
File to load |
Returns:
A promise to the document
- Type
- promise.<Doc>
setContent(content) → {Doc}
Parameters:
Name | Type | Description |
---|---|---|
content |
string | Content (encoded in base 64) |
Returns:
This document for chaining
- Type
- Doc
setContentFromText(content) → {Doc}
Parameters:
Name | Type | Description |
---|---|---|
content |
string | Content as plain text string |
Returns:
This document for chaining
- Type
- Doc
setFileName(name)
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name |
setFilename(name)
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name |
setMIMEType(mime) → {Doc}
Parameters:
Name | Type | Description |
---|---|---|
mime |
string | MIME type |
Returns:
This document for chaining
- Type
- Doc
setMimeType(mime)
Parameters:
Name | Type | Description |
---|---|---|
mime |
string | MIME type |
setName(name) → {Doc}
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name |
Returns:
This document for chaining
- Type
- Doc