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.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
Members
(static, constant) MIME_TYPE :string
Type:
- string
- Default Value:
- "application/octet-stream"
Methods
(static) getCustomMetadata() → (nullable) {object}
Returns the metadata.
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:
The 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) getInputStream() → (nullable) {stream.Readable}
Get the input file path when uploading content.
Returns:
The input stream, or
null
if not set.
- Type
- stream.Readable
(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:
The name of this object in the storage cloud.
- Type
- string
(static) getOutputStream() → (nullable) {stream.Writable}
Get the output file path when downloading content.
Returns:
The output stream, or
null
if not set.
- Type
- stream.Writable
(static) getType() → {string}
Get the mime-type of the content.
- See:
Returns:
the mime-type of the content.
- Type
- string
(static) getURI() → (nullable) {string}
Get the URI value.
Returns:
The 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) setInputStream(stream)
Set an input stream for content to be uploaded. The implementation allows for either the
input stream to be set, or the output stream to be set, but not both. If the input stream
parameter is not null, the output stream will be set to null.
Parameters:
Name | Type | Description |
---|---|---|
stream |
stream.Readable | A readable stream to which the content will be read. |
(static) setOutputStream(stream)
Set an output stream for content to be downloaded. The implementation allows for either the
output stream to be set, or the input stream to be set, but not both. If the output stream
parameter is not null, the input stream will be set to null.
Parameters:
Name | Type | Description |
---|---|---|
stream |
stream.Writable | A writable stream to which the content will be written. |
(static) sync(callback)
Synchronize content with the Storage Cloud Service.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | The callback function. |