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 |
Methods
-
addFile(name, content [, callback])
-
Adds content to the artifact as a file.
Parameters:
Name Type Argument Description name
string filename
content
Blob File object or Blob.
callback
function <optional>
if provided no promise will be returned.
Returns:
On success the promise will be resolved with {string} metadataHash.
On error the promise will be rejected with Error error.- Type
- external:Promise
-
addFileAsSoftLink(name, content [, callback])
-
Adds files as soft-link.
Parameters:
Name Type Argument Description name
string filename.
content
Blob File object or Blob.
callback
function <optional>
if provided no promise will be returned.
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 [, callback])
-
Adds multiple files.
Parameters:
Name Type Argument Description files
Object.<string, Blob> files to add
callback
function <optional>
if provided no promise will be returned.
Returns:
On success the promise will be resolved with {string[]} metadataHashes.
On error the promise will be rejected with string error.- Type
- external:Promise
-
addFilesAsSoftLinks(files [, callback])
-
Adds multiple files as soft-links.
Parameters:
Name Type Argument Description files
Object.<string, Blob> files to add
callback
function <optional>
if provided no promise will be returned.
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 [, size] [, callback])
-
Adds a hash to the artifact using the given file path.
Parameters:
Name Type Argument 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.
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 [, callback])
-
Adds hashes to the artifact using the given file paths.
Parameters:
Name Type Argument Description metadataHashes
object.<string, string> Keys are file paths and values metadata hashes.
callback
function <optional>
if provided no promise will be returned.
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 [, callback])
-
Adds a hash to the artifact using the given file path.
Parameters:
Name Type Argument 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.
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 [, callback])
-
Adds hashes to the artifact using the given file paths.
Parameters:
Name Type Argument Description metadataHashes
object.<string, string> Keys are file paths and values metadata hashes.
callback
function <optional>
if provided no promise will be returned.
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( [callback])
-
Saves this artifact and uploads the metadata to the server's storage.
Parameters:
Name Type Argument Description callback
function <optional>
if provided no promise will be returned.
Returns:
On success the promise will be resolved with {string} metadataHash.
On error the promise will be rejected with Error error.- Type
- external:Promise