Class: Artifact

Artifact(name, blobClient, descriptor)

new Artifact(name, blobClient, descriptor)

Creates a new instance of artifact, i.e. complex object, in memory. This object can be saved in the blob-storage on the server and later retrieved with its metadata hash.

Parameters:
Name Type Description
name string

Artifact's name without extension

blobClient BlobClient
descriptor BlobMetadata
Source:

Methods

addFile(name, content, callbackopt) → {external:Promise}

Adds content to the artifact as a file.

Parameters:
Name Type Attributes Description
name string

filename

content Blob

File object or Blob.

callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with {string} metadataHash.
On error the promise will be rejected with Error error.

Type
external:Promise

Adds files as soft-link.

Parameters:
Name Type Attributes Description
name string

filename.

content Blob

File object or Blob.

callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with {string} metadataHash.
On error the promise will be rejected with Error error.

Type
external:Promise

addFiles(files, callbackopt) → {external:Promise}

Adds multiple files.

Parameters:
Name Type Attributes Description
files Object.<string, Blob>

files to add

callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with {string[]} metadataHashes.
On error the promise will be rejected with string error.

Type
external:Promise

Adds multiple files as soft-links.

Parameters:
Name Type Attributes Description
files Object.<string, Blob>

files to add

callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with {string[]} metadataHashes.
On error the promise will be rejected with Error error.

Type
external:Promise

addMetadataHash(name, metadataHash, sizeopt, callbackopt) → {external:Promise}

Adds a hash to the artifact using the given file path.

Parameters:
Name Type Attributes Description
name string

Path to the file in the artifact. Note: 'a/b/c.txt'

metadataHash string

Metadata hash that has to be added.

size number <optional>

Size of the referenced blob.

callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with {string} hash.
On error the promise will be rejected with Error error.

Type
external:Promise

addMetadataHashes(metadataHashes, callbackopt) → {external:Promise}

Adds hashes to the artifact using the given file paths.

Parameters:
Name Type Attributes Description
metadataHashes object.<string, string>

Keys are file paths and values metadata hashes.

callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with {string[]} hashes.
On error the promise will be rejected with Error error.

Type
external:Promise

addObjectHash(name, metadataHash, callbackopt) → {external:Promise}

Adds a hash to the artifact using the given file path.

Parameters:
Name Type Attributes Description
name string

Path to the file in the artifact. Note: 'a/b/c.txt'

metadataHash string

Metadata hash that has to be added.

callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with {string} hash.
On error the promise will be rejected with Error error.

Type
external:Promise

addObjectHashes(metadataHashes, callbackopt) → {external:Promise}

Adds hashes to the artifact using the given file paths.

Parameters:
Name Type Attributes Description
metadataHashes object.<string, string>

Keys are file paths and values metadata hashes.

callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with {string[]} hashes.
On error the promise will be rejected with Error error.

Type
external:Promise

save(callbackopt) → {external:Promise}

Saves this artifact and uploads the metadata to the server's storage.

Parameters:
Name Type Attributes Description
callback function <optional>

if provided no promise will be returned.

Source:
Returns:

On success the promise will be resolved with {string} metadataHash.
On error the promise will be rejected with Error error.

Type
external:Promise