Hyperion

Hyperion

Handles all the functions related to hyperion

Constructor

new Hyperion(options)

Source:
Parameters:
Name Type Description
options object

Options

Properties
Name Type Description
apiKey string

API Key for authentication

[domain string

Domain where the platform is hosted

Methods

(async) deleteFile(options, locationCode, fileHash) → {Promise.<any>}

Source:

Deletes a file from hyperion node

Example

Deletes a file from hyperion service

const res = await hyperion.deleteFile({locationCode: 'us-west-2', fileHash: 'wefjhggbhoirekuyghiqwlyug'})
Parameters:
Name Type Description
options object

File options

locationCode string

Location code of the node where the file was uploaded

fileHash string

Hash of the file to delete

Returns:

Response of delete operation or error

Type
Promise.<any>

getFile(options) → {Promise.<any>}

Source:

Downloads a file from hyperion using the hash

Example

Downloads a file from hyperion service

const writeStream = fs.createWriteStream('download-path.txt');
const res = await hyperion.getFile({locationCode: 'us-west-2', fileHash: 'ajshdvi23y4ioiertuykesd', writeStream });
Parameters:
Name Type Description
options object

File options

Properties
Name Type Description
locationCode string

Location code of the hyperion node where the file was uploaded

fileHash string

Hash of the file to download

writeStream writeStream

A writestream to which the downloaded file will be written

Returns:

Error or response status code

Type
Promise.<any>

uploadFile(options) → {Promise.<string>}

Source:

Uploads a file to hyperion service

Example

Uploads a file to hyperion

const fileReadStream = fs.createReadStream('file_to_read.txt');
const fileHash = await hyperion.uploadFile({fileStream: fileReadStream, locationCode: 'us-west-2'});
console.log(fileHash);
// Prints the hash of the file in the hyperion cloud
Parameters:
Name Type Description
options object

File options

Properties
Name Type Description
fileStream readStream

A read stream to the file which is to be uploaded

locationCode string

Location code of the hyperion node where the file is to be uploaded

Returns:

Hash of the uploaded file

Type
Promise.<string>