Constructor
new Doc(valueopt)
- Description:
- Constructor
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
value |
string | object |
<optional> |
Document name or value
Properties
|
Methods
getContent() → {string}
- Description:
- Get the document content (encoded in base 64)
- Source:
Returns:
Content
- Type
- string
getContentAsArrayBuffer() → {ArrayBuffer}
- Description:
- Get the document content as an array buffer
- Source:
Returns:
Content as an array buffer
- Type
- ArrayBuffer
getContentAsText() → {string}
- Description:
- Get the document content as a text
- Source:
Returns:
Content as plain text
- Type
- string
getDataURL(thumbnailopt) → {string}
- Description:
- Get the document data URL
- Source:
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}
- Description:
- Alias to
getName
- Alias to
- Source:
Returns:
Name
- Type
- string
getFilename() → {string}
- Description:
- Alias to
getName
- Alias to
- Source:
Returns:
Name
- Type
- string
getId() → {string}
- Description:
- Get the document ID
- Source:
Returns:
ID
- Type
- string
getMIMEType() → {string}
- Description:
- Get the document MIME type
- Source:
Returns:
MIME type
- Type
- string
getMimeType() → {string}
- Description:
- Alias to
getMIMEType
- Alias to
- Source:
Returns:
MIME type
- Type
- string
getName() → {string}
- Description:
- Get the document name
- Source:
Returns:
Name
- Type
- string
getThumbnail() → {string}
- Description:
- Get the document thumbnail (encoded in base 64)
- Source:
Returns:
Thumbnail
- Type
- string
getThumbnailAsArrayBuffer() → {ArrayBuffer}
- Description:
- Get the document thumbnail as an array buffer
- Source:
Returns:
Thumbnail as an array buffer
- Type
- ArrayBuffer
getValue() → {object}
- Description:
- Get the document as a plain value object
- Source:
Returns:
Value object
- Type
- object
load(file) → {promise.<Doc>}
- Description:
- Load file
- Source:
Parameters:
Name | Type | Description |
---|---|---|
file |
File to load |
Returns:
A promise to the document
- Type
- promise.<Doc>
setContent(content) → {Doc}
- Description:
- Set the document content
- Source:
Parameters:
Name | Type | Description |
---|---|---|
content |
string | Content (encoded in base 64) |
Returns:
This document for chaining
- Type
- Doc
setContentFromText(content) → {Doc}
- Description:
- Set the document content from plain text string
- Source:
Parameters:
Name | Type | Description |
---|---|---|
content |
string | Content as plain text string |
Returns:
This document for chaining
- Type
- Doc
setFileName(name)
- Description:
- Alias to
setName
- Alias to
- Source:
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name |
setFilename(name)
- Description:
- Alias to
setName
- Alias to
- Source:
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name |
setMIMEType(mime) → {Doc}
- Description:
- Set the document MIME type
- Source:
Parameters:
Name | Type | Description |
---|---|---|
mime |
string | MIME type |
Returns:
This document for chaining
- Type
- Doc
setMimeType(mime)
- Description:
- Alias to
setMIMEType
- Alias to
- Source:
Parameters:
Name | Type | Description |
---|---|---|
mime |
string | MIME type |
setName(name) → {Doc}
- Description:
- Set the document name
- Source:
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name |
Returns:
This document for chaining
- Type
- Doc