Constructor
new StorageObject(urinullable, namenullable, typenullable, encodingnullable, datenullable, lengthopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
uri |
string |
<nullable> |
The full URI of the object in the Storage Cloud. | |
name |
string |
<nullable> |
The name of the object used in the Storage Cloud. | |
type |
string |
<nullable> |
The type of the object, if null then
iotcs.device.StorageObject.MIME_TYPE . |
|
encoding |
string |
<nullable> |
The encoding of the object, or null if none. |
|
date |
Date |
<nullable> |
The last-modified date of the object. | |
length |
number |
<optional> |
-1 | The length of the object. |
Extends
Classes
Methods
(static) getCustomMetadata() → (nullable) {object}
Returns an unmodifiable copy of the custom metadata of this storage object.
Returns:
The custom metadata for this storage object, or
null
.
- Type
- object
(static) getDate() → (nullable) {Date}
Get the date and time the content was created or last modified in cloud storage.
Returns:
date the content was last modified in cloud storage,
or
null
if the content has not been uploaded
- Type
- Date
(static) getEncoding() → (nullable) {string}
Get the compression scheme of the content.
Returns:
the compression scheme of the content,
or
null
if the content is not compressed
- Type
- string
(static) getInputPath() → {string}
Get the input file path when uploading content.
Returns:
input file path
- Type
- string
(static) getLength() → {number}
Get the length of the content in bytes.
This is the number of bytes required to upload or download the content.
Returns:
the length of the content in bytes, or
-1
if unknown
- Type
- number
(static) getName() → {string}
Get the the name of this object in the storage cloud.
This is name and path of the file that was uploaded to the storage cloud.
Returns:
name
- Type
- string
(static) getOutputPath() → {string}
Get the output file path when downloading content.
Returns:
output file path
- Type
- string
(static) getSyncStatus()
Get the status of whether or not the content is in sync with the storage cloud.
(static) getType() → {string}
Get the mime-type of the content.
- See:
Returns:
type
- Type
- string
(static) getURI() → (nullable) {string}
Get the URI value.
Returns:
A URI, or
null
if unknown.
- Type
- string
(static) setCustomMetadata(key, value)
Adds this metadata to the StorageObject.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | The metadata key. |
value |
string | The metadata value. |
Throws:
Error - If key or value are
undefined
, null
, or empty.
(static) setInputPath(path)
Set an input file path for content to be uploaded.
The implementation allows for either the input path to be set,
or the output path to be set, but not both.
If the input path parameter is not null, the output path will be set to null.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | input file path to which the content will be read. |
(static) setOutputPath(path)
Set an output file path for content to be downloaded.
The implementation allows for either the output path to be set,
or the input path to be set, but not both.
If the output path parameter is not null, the input path will be set to null.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | output file path to which the content will be written. |
(static) sync()
Notify the library to sync content with the storage cloud.
Type Definitions
onSyncCallback(event)
Callback function called when sync is complete.
Parameters:
Name | Type | Description |
---|---|---|
event |
iotcs.device.Sync.SyncEvent | A SyncEvent with the result of the sync. |