@nat Sure, I will send a mail to partnerships@tardigrade.io.
The code for Node app I am working with:
const fs = require("fs");
//include the Node.js-Storj bindings module
var storj = require("./libUplinkNode.js");
// object for all the function for uplink
var libUplink = storj.storj_nodejs;
//
const BUFFER_SIZE = 80000;
//
const RETRY_MAX = 5;
// demo Storj (V3) configuration
var storjConfig = {
apiKey :
"13Yqdce2jc5NEvo6s9BRMdCyQ6mF6rUFsyrD7Vys7ASv2x5GMtADhrBsvD7NTmKw12ugqjx38VjztwTaK2kzGSEBXB7H1vm1PLdENcE",
satelliteURL : "us-central-1.tardigrade.io:7777",
encryptionPassphrase : "liberty or death",
bucketName : "liberty",
uploadPath : "CTS",
};
// file names to be uploaded or downloaded as
var localFullFileName = {
src : "/home/hanani8/Desktop/cheesecake.jpg",
dest: "/home/hanani8/Desktop/gunjan.jpg",
};
var objectsize =0;
console.log("Getting Access\nSatellite Address : ",storjConfig.satelliteURL,"\nAPI key : ",storjConfig.apiKey,"\nEncryption Passphrase : ",storjConfig.encryptionPassphrase);
var lO_AccessResult = libUplink.request_access_with_passphrasec(storjConfig.satelliteURL,storjConfig.apiKey,storjConfig.encryptionPassphrase);
if(lO_AccessResult.error.message == ""){
console.log("Access : Granted !!");
console.log("Opening Storj Project...");
var lO_ProjectResult = libUplink.open_projectc(lO_AccessResult.access);
if(lO_ProjectResult.error.message == ""){
console.log("Desired Storj Project: OPENED!");
console.log("Fetching Information About Bucket : ",storjConfig.bucketName);
var lO_BucketResult = libUplink.stat_bucketc(lO_ProjectResult.project,storjConfig.bucketName);
if(lO_BucketResult.error.message != ""){
console.log("\nFAILed to get bucket information !\n","error code : ",lO_BucketResult.error.code,"\t error message : ",lO_BucketResult.error.message);
}else{
console.log("\nBucket Information : \n Bucket Name : ",lO_BucketResult.bucket.name,"\n Bucket Created : ",getDateTime(lO_BucketResult.bucket.created));
}
console.log("Creating Bucket : ",storjConfig.bucketName);
var lO_createBucketResult = libUplink.create_bucketc(lO_ProjectResult.project,storjConfig.bucketName);
if(lO_createBucketResult.error.message == ""){
console.log("\nBucket created successfully !\n","Bucket Name : ",lO_createBucketResult.bucket.name,"\t Created : ",getDateTime(lO_createBucketResult.bucket.created));
}else{
console.log("\nFAILed to create bucket !\n","error code : ",lO_createBucketResult.error.code,"\t error message : ",lO_createBucketResult.error.message);
}
console.log("Creating restrict access....");
var lO_Permission = new storj.Permission();
lO_Permission.allow_delete = true
lO_Permission.allow_list = true
lO_Permission.allow_download = true
lO_Permission.allow_upload = true
var lO_SharePrefix = storj.SharePrefix;
var lO_SharePrefixListArray = [];
lO_SharePrefix.bucket = "liberty";
lO_SharePrefix.prefix ="CTS";
lO_SharePrefixListArray.push(lO_SharePrefix);
var lO_AccessShareResult = libUplink.access_sharec(lO_AccessResult.access,lO_Permission,lO_SharePrefixListArray,lO_SharePrefixListArray.length);
console.log(lO_Permission);
console.log(lO_AccessShareResult);
console.log(lO_AccessShareResult.access);
if(lO_AccessShareResult.error.message==""){
console.log("Created share access !!");
console.log("Creating Share Access Key...");
var lO_StringResult = libUplink.access_serializec(lO_AccessShareResult.access);
console.log(lO_StringResult);
if(lO_StringResult.error.message==""){
var lO_AccessResultSharedObject= libUplink.parse_accessc(lO_StringResult.string);
console.log(lO_AccessResultSharedObject);
console.log("Parsing Access created");
console.log("Opening Project Using Shared Access..." );
var lO_RestrictedProjectResult = libUplink.open_projectc(lO_AccessResultSharedObject.access);
if(lO_RestrictedProjectResult.error.message==""){
console.log("Opened Project using share key ");
}else{
console.log("FAILed to open project \n Error Code : ",lO_RestrictedProjectResult.error.code,"\t Error Message : ",lO_RestrictedProjectResult.error.message);
}
var lO_ProjectError = libUplink.close_projectc(lO_ProjectResult.project);
console.log("\nClosing Project !");
if(lO_ProjectError.error.message == ""){
console.log("Closed desired project!\n");
}else{
console.log("\nFAILed to close desired project!\n","Error Code : ",lO_ProjectError.error.code,"\t Error Message : ",lO_ProjectError.error.message);
}
}else{
console.error("\nFAILed to open desired project!\n","Error Code : ",lO_ProjectResult.error.code,"\t Error Message : ",lO_ProjectResult.error.message);
}
}else{
console.error("\nFAILed to get access !\n","Error Code : ",lO_AccessResult.error.code,"\t Error Message : ",lO_AccessResult.error.message);
}
function getDateTime(unix_timestamp) {
var dateTime = new Date(unix_timestamp * 1000);
//
var year = dateTime.getFullYear();
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var month = months[dateTime.getMonth()];
var date = "0" + dateTime.getDate();
//
// Hours part from the timestamp
var hours = "0" + dateTime.getHours();
// Minutes part from the timestamp
var minutes = "0" + dateTime.getMinutes();
// Seconds part from the timestamp
var seconds = "0" + dateTime.getSeconds();
// Will display date time in YYYY-Mon-DD HH:MM:SS format
var formattedDateTime = year + '-' + month + '-' + date.substr(-2) + ' ' + hours.substr(-2) + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
//
return formattedDateTime
}