Hyperion

Hyperion

new Hyperion()

Handles all the functions related to hyperion

Source:

Methods

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

Deletes a file from hyperion node

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

Source:
Returns:

Response of delete operation or error

Type
Promise.<any>
Example

Deletes a file from hyperion service

const res = await hyperion.deleteFile({locationCode: 'us-west-2', fileHash: 'wefjhggbhoirekuyghiqwlyug'})

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

Downloads a file from hyperion using the hash

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

Source:
Returns:

Error or response status code

Type
Promise.<any>
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 });

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

Uploads a file to hyperion service

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

Source:
Returns:

Hash of the uploaded file

Type
Promise.<string>
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