Giter Site home page Giter Site logo

ibm / aspera-connect-sdk-js Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 2.0 32.61 MB

Official Aspera Connect SDK for Javascript

Home Page: https://ibm.github.io/aspera-connect-sdk-js/

License: Apache License 2.0

JavaScript 20.29% TypeScript 77.30% HTML 0.05% SCSS 2.36%
javascript typescript aspera sdk aspera-connect connect-sdk aspera-sdk asperaweb aspera-connect-sdk aw4

aspera-connect-sdk-js's Introduction

CII Best Practices npm

Official Aspera Connect SDK for JavaScript

Enables web applications to utilize Aspera file-transfer capabilities.

Check out GitHub Pages for documentation.

Installation

Install from npm:

$ npm install --save @ibm-aspera/connect-sdk-js

Install from source:

$ git clone https://github.com/IBM/aspera-connect-sdk-js.git
$ cd aspera-connect-sdk-js
$ npm install

Load from the CDN:

<script src="https://d3gcli72yxqn2z.cloudfront.net/@ibm-aspera/connect-sdk-js/latest/connect-sdk.js"></script>

It's highly recommended if you embed the Connect SDK via CDN that you use a specific version instead of using the latest. The latest Connect SDK is subject to change at any time with breaking changes, which could potentially affect your website.

Usage

Launch and establish a connection to the Connect desktop application:

import { Connect } from '@ibm-aspera/connect-sdk-js';

const connectClient = new Connect();
connectClient.initSession();

Start a download:

try {
  const transferSpec = {
    authentication: 'token',
    paths: [
      {
        source: 'my_awesome_movie.drp'
      }
    ],
    remote_host: 'example.com',
    remote_user: 'foo',
    token: 'ATV7_HtfhDa-JwWfc6RkTwhkDUqjHeLQePiOHjIS254_LJ14_7VTA',
    direction: 'receive'
  };

  const response = await connectClient.startTransferPromise(transferSpec);
  console.log(`Transfer started: ${response}`);
} catch(err) {
  throw new Error(`Could not start transfer: ${err}`);
}

Check out the provided Examples for more code samples.

Migration from 3.x/4.x to 5.0.0

Refer to MIGRATION to see the required changes when updating your code to v5.0.0.

Development

Prerequisites

  • Node.js v12+
    • If you are on macOS, we recommend installing Node.js via a package manager such as nvm.
  • Git

Build

$ git clone https://github.com/IBM/aspera-connect-sdk-js.git
$ cd aspera-connect-sdk-js
$ npm install
$ npm run build

Locally hosting the Connect desktop installers

Rather than having users download Connect from Cloudfront, it is possible to host the installers locally. This is particularly useful if your server is running in an offline environment (i.e. users will not have access to Cloudfront) or if you would simply prefer users download Connect from your server.

To download the connect-deployer Docker image:

$ docker pull icr.io/ibmaspera/connect-deployer:latest

Version tags are also available starting from Connect 4.2.2 (ex: docker pull icr.io/ibmaspera/connect-deployer:4.2.2).

To host the installers on a basic web server:

$ docker run -it --rm -d -p 8080:80 icr.io/ibmaspera/connect-deployer:latest

With the above command, the Connect installers will be available over http://127.0.0.1:8080/aspera/connect. To configure the Connect SDK to serve the Connect installers from this URL you must update sdkLocation to the above URL.

To host the installers over a secure web server:

$ docker run -it --rm -d -p 8443:443  -v /path/to/your/ssl/certs:/etc/ssl/certs icr.io/ibmaspera/connect-deployer:latest

Note: The server certificate and private key must be named cert.pem and key.pem, respectively.

Contributing

We're always looking for contributors to help us fix bugs, build new features, or help us improve the project documentation. If you're interested, definitely check out our Contributing Guide.

Troubleshooting

In the browser, run AW4.Logger.setLevel(2) in the Developer Console to enable trace logging.

For help regarding the Connect desktop application, please visit IBM Support.

aspera-connect-sdk-js's People

Contributors

anubhatia1 avatar dwosk avatar gegles avatar jahmcr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

mdashlw enemily

aspera-connect-sdk-js's Issues

Connect client event listener keeps executing on failure

Description:
The Connect client event listener keeps triggering the event listener function even when status is failed. I can see it been useful for transfer events and keeping track of them, but I'm unsure if this is the expected behavior for the "status" event handler.

Environment:

  • @ibm-aspera/connect-sdk-js: 5.0.0
  • Node version: 18.17.0
  • Browser version: Firefox 115.0.2
  • Operating System: macOS Ventura 13.4.1

Example:

import { Connect, ConnectInstaller } from "@ibm-aspera/connect-sdk-js";

const connectClient = new Connect();
const connectInstaller = new ConnectInstaller();

function myCustomHandler(type, status) {
    if (status === 'FAILED') {
       // Handle failed status
       connectInstaller.showDownload();
   }
}
connectClient.addEventListener(“status”, myCustomHandler);

After dismissing the install dialog from the connect installer showDownload() function, the status will continue to trigger as ‘failed’ and re-open the dialog.

Expected behaviour:
Status change is triggered once.

Actual behaviour:
Status change is triggered indefinitely.

Failed Connect SDK transfer request on HSTE

Hello,

We have installed HST Endpoint for use in conjunction with the web using the Connect SDK.
However, an error occurred during the transfer test on the web, so we're inquiring.

Currently, the same web server is using the SDK to connect to the HST Server normally, but file transfer is not working properly while connecting the HST Endpoint.

We attached the log that we tried to test today, so please check it
(HSTE has no logs and includes client logs and console logs from Web browser developer tools,
The content of "web_browser_console log.txt" is the developer mode console message of the web browser developer tool)

Thank you

240522_log.zip

Installation banner should take into account the request strategy used

The two-step banner was designed in mind that the web extension strategy would be used. However, the HTTP strategy can be used by setting connectMethod: 'http'. In this case, the UI should not show "Install Extension" since it is not actually required. We used to have the "blue" banner to handle the HTTP strategy, but we've since removed it from the SDK.

We should update the UI to handle the HTTP strategy properly. This will become more important if/when we make the HTTP strategy the default again and mitigate the need for a web extension since mainstream browsers (mainly Chrome/Firefox) now treat HTTP requests to 127.0.0.1 as secure.

Can aspera docroot path have bucket along with folder specified for s3 download?

Hi Team,

I need to download file from S3 bucket to local system using aspera sdk(directly from S3 to local).

The source file path is as below:
https://xyz.s3.region.amazonaws.com/Folder1/2023/others/File.mp4
where
xyz = bucket name
/Folder1/2023/others/File.mp4 = file path

The docroot specified in the aspera.conf file for user is as below:
s3://xcsfsfqrqwrqwr%[email protected]/xyz
where
xyz = bucket name

Is it possible to specify the docroot path having folder name also, as below ? so that the aspera user has access to only the given folder under the bucket, and not the whole bucket.
s3://xcsfsfqrqwrqwr%[email protected]/xyz/Folder1
where
xyz = bucket name
**Folder1 = folder **

Thanks in advance.

How to locally host Connect Installers in React environment

Dear dwosk,
I'm clear that how to host ConnectSDK locally in Normal(vanilla) Javascript.
But can't code how to host Connect Installers locally in React.
.......
This is my example which didn't work.
.......

import './App.css';
import { Connect, ConnectInstaller } from '@ibm-aspera/connect-sdk-js';

const connect = new Connect();
const options = { sdkLocation: "//localhost:3000/connectsdk/v4" };
// const options = {};
const connectInstaller = new ConnectInstaller(options);
connect.initSession();

function statusEventListener(eventType, data) {
if (eventType === Connect.EVENT.STATUS && data === Connect.STATUS.INITIALIZING) {
connectInstaller.showLaunching();
} else if (eventType === Connect.EVENT.STATUS && data === Connect.STATUS.EXTENSION_INSTALL) {
connectInstaller.showExtensionInstall();
} else if (eventType === Connect.EVENT.STATUS && data === Connect.STATUS.FAILED) {
connectInstaller.showDownload();
} else if (eventType === Connect.EVENT.STATUS && data === Connect.STATUS.OUTDATED) {
connectInstaller.showUpdate();
} else if (eventType === Connect.EVENT.STATUS && data === Connect.STATUS.RUNNING) {
connectInstaller.connected();
}
};

function transferEventListener(type, allTransfersInfo) {
if (type === Connect.EVENT.TRANSFER) {
console.log('Received transfer event!')
}
};

connect.addEventListener(Connect.EVENT.STATUS, statusEventListener );
connect.addEventListener(Connect.EVENT.TRANSFER, transferEventListener);

connect.initSession();

function testAspera() {

const transferSpec = {
paths: [
{
source: 'aspera-test-dir-large/100MB'
}
],
remote_host: 'demo.asperasoft.com',
remote_user: 'aspera',
remote_password: 'demoaspera',
direction: 'receive'
};

var connectSpec = {
"allow_dialogs" : true,
"return_paths" : false,
"return_files" : true,
"use_absolute_destination_path" : false
};

var transferCallback = {
success: function(result) {
console.log('Start Aspera Transfer');
},
error: function(result) {
console.log('Start Failed by Console message');
}
};

connect.startTransferPromise(transferSpec, connectSpec, transferCallback);
}

function App() {

return (

<input type="button" value={'Transfer Test'} onClick={testAspera}/>

); }

export default App;

Aspera Connect is not recognized by the browser (Chrome)

Hello,

We installed aspera connect on the user's PC, but the web browser keeps popping up asking us to install aspera connect.

We attached a screen (Aspera Connect error.jpg) that occurs when we access the aspera transfer page with Aspera connect installed and aspera connection test page access screen (Aspera test page error.jpg).
And the native message host debugging log was also collected because messages related to native host were found in the browser console log.
Log File Download URL : https://drive.google.com/file/d/16C6oWbMalMd0Uf0nxUxE3RnAIBWG4Z9h/view?usp=share_link

Other users can access and test https://test-connect.ibmaspera.com/ well, but this user above does not go to the next step on the loading screen even on the test page.
We have reinstalled browser extension and aspera connection (both 4.1.0 & 4.2.5) several times, but the issue has not been resolved

We tried accessing the web page before 3/30 and attached the log file, so please check.

OS : Windows 10 Enterprise 17763.3532
Chrome : 111.0.5563.146
Aspera Connect : 4.1.0
Aspera SDK : 4.1.0

Thank you

File transfer error in Connect SDK environment

Hello

We are using Aspera HSTS and Aspera Connect SDK (HSTS 4.1.0 & Connect SDK 4.1.0)
However, on a specific user's PC, files cannot be transmitted from the web page, and an error has occurred, so I leave an inquiry

This is the first time to transfer files from a web page on this PC, and internal security policies do not allow it to access the Aspera Connect Test page (https://test-connect.ibmaspera.com/) so we couldn't do with the Aspera Connect test.

I'm attaching the web console log of the browser developer tool and the client's log file, so please check it.

Thank you.

231130_Connect SDK Fail.zip

Banner contains -HEAD as branch suffix

The banner in the header of the bundled SDK is supposed to use a git branch suffix for builds coming from any branch except main. However, it looks like the git branch that is detected in the CI action is HEAD and so we end up with something like Connect SDK v5.0.0-HEAD instead of Connect SDK v5.0.0.

Upload file failed by drag and drop

Hi everyone, I have problem with upload by drag&drop files on Ubuntu, MacOS and probably Windows.

Upload file via asper dialog works perfectly.
But when I use method: setDragDropTargets(doc) for uploading the same file, an error is returned:

{
 error: {
  code: 406,
  internal_message: "Not Acceptable",
  user_message: "can't upload unauthorized file \\"totest.png\\""
 }
}

The only difference in the transfer that I can see between these upload methods is the path to the file:

#Dialog upload config paths
{
  ...
  paths: [
   {source: '/home/vida/Obrazy/Zrzuty ekranu/totest.png', destination: '865038bd-0cc3-47c5-8c54-9632d943b526.png'}
  ],
  ...
}

**it's work**
#Drag&Drop upload config paths
{
 ...
 paths: [
  {source: 'totest.png', destination: 'f0faef6a-359d-4a67-b6d0-21528f3c7a3c.png'}
 ],
 ...
}

**It doesn't work**

Has anyone faced a similar problem or know a solution for this case?

Regarding queries on Aspera Connect SDK

Hi Team, I am trying Folder Upload using Aspera Connect SDK(using asperaweb-4.js) and have below queries, please help with them:

1- Does asperasdk create separate objects for each file during folder upload?
2- How do we do folder upload with exception to skip few files (folder path specified in paths property of transfer spec of starttransfer)?
For example, uploading folder D:/Test/abc, and want to skip uploading few files from the folder like /Test/abc/test1.jpg, /Test/abc/test2.jpg. We have file names or extensions of files to be skipped.
3- Is there any threshold in Folder upload for number of files that can be transferred within folder?
4- If we do upload, using multiple source paths mentioned in 'paths' property of TransferSpec for startTransfer (transfer multiple files in single transfer session), is there any threshold for number of paths that will be allowed for transfer?
ex of transfer spec:
{
"authentication": "password",
"cipher": "none",
"cookie": "...",
"create_dir": "False",
"destination_root": null,
"direction": "send",
"http_fallback": false,
"http_fallback_port": 0,
"lock_min_rate": false,
"lock_target_rate": false,
"min_rate_kbps": 5000,
"paths": [
{
"destination": "xyz.mov",
"source": "C:\\Users\\abc\\Downloads\\abc.mov"
},
{
"destination": "\\POC\\abc.mp3",
"source": "C:\\Users\\abc\\Downloads\\abc.mp3"
}],
"remote_host": "asperaHost",
"remote_user": "userAspera",
"resume_check": "full_checksum",
"ssh_port": 33001,
"tags": {
"aspera": {
"xfer_id": "...",
"xfer_retry": 90
}
},
"target_rate_kbps": 10000,
"uuid": "......"
}
5- What are the reasons for getting below error during multiple file upload in single transfer session:
"error_code": 63,
"error_desc": "Source path stat failed"
6- Is there a way to know from aspera transfer progress events, that which files failed to upload upfront? or we can know it by checking which files are not part of 'files' property in TransferInfo or bytes_written is not equal to bytes_expected, those would be failed?
TransferInfo:
"files": [
{
"bytes_expected": 1998617,
"bytes_written": 1998617,
"fasp_file_id": "..",
"file": "D:\Test files\flower.jpg"
},
{
"bytes_expected": 5518662,
"bytes_written": 5518662,
"fasp_file_id": "...",
"file": "D:\Test files\notification.pdf"
}]
7- In TransferInfo json, file_counts has 'failed' property. In which scenario does this property gets populated?

Would be grateful to receive any inputs on these. Thanks in advance.

Why don't you use the transfer token in the upload example?

We are trying to transfer files via the Aspera HttpGateway SDK.
First we created a transfer token via the API passing the following json in the body:
{
"transfer_requests": [
{
"transfer_request": {
"destination_root": "/data/aspera_xxx/folder",
"token_life_seconds": 43200,
"paths": [
{
"source": "filename.txt",
"destination": "filename.txt"
}
],
"remote_host": "hosts",
"cipher_allowed": "aes-128",
"fasp_port": 33001,
"ssh_port": 33001,
"http_fallback": false,
"http_fallback_port": 443,
"https_fallback_port": 443,
"rate_policy_allowed": "fixed",
"rate_policy": "fair",
"target_rate_kbps": 10000,
"target_rate_cap_kbps": 20000
}
}
]
}

Once we have obtained the transfer token, we have created an html page where we call the following javascript code:

const transferSpec = {
paths: [
{
"source": "filename.txt",
"destination": "filename.txt"
}
],
destination_root: "/data/aspera_xxx/folder",
token: <TRANSFER_TOKEN>,
direction: "send",
target_rate_cap_kbps: 20000,
cipher: "aes-128",
tags: null,
rate_policy_allowed: "fixed",
rate_policy: "fair",
target_rate_kbps: 10000,
min_rate_kbps: 0,
lock_min_rate: true,
remote_host: "hosts",
remote_user: "xfer",
sshfp: "a92abfb6d6b00b725cc47ce787639e1f2b192f3c",
ssh_port: 33001,
fasp_port: 33001,
http_fallback: false,
authentication: "tokens",
};

For each attempt we get the error

Authorization refused: token doesn't match file list
sdk_aspera.zip

How can we fix this error?

getCheckSum not working

Hi,

I can't seem to get the getChecksum function to work.

Using this code from the upload example file.

Can't seem to get any sort of data from it? My goal is to get an MD5 hash of the whole file before uploading.

function uploadFile(data) {
  const { files } = data.dataTransfer;
  if (files.length === 1) {
    let fileToUpload = files[0].name;

    /**
     * Transfer spec with desired parameters
     */
    const transferSpec = {
      paths: [
        {
          source: fileToUpload,
        },
      ],
      destination_root: "Upload",
      remote_host: "demo.asperasoft.com",
      remote_user: "aspera",
      remote_password: "demoaspera",
      direction: "send",
    };

    this.client.getChecksum(
      {
        path: files[0].name,
        offset: 0,
        chunkSize: files[0].size,
        checksumMethod: "md5",
      },
      {
        success: (check) => {
          alert(check);
        },
        error: (error) => {
          console.log(error);
        },
      }
    );

    this.client.startTransfer(transferSpec);
  }
}

function upload() {
  /**
   * Display a file browser for the user to select a file.
   */
  const options = {
    allowMultipleSelection: false,
  };

  this.client
    .showSelectFileDialogPromise(options)
    .then(uploadFile)
    .catch(() => {
      console.error("Unable to select files");
    });
}

function initAsperaConnect() {
  this.client = new AW4.Connect();
  this.client.initSession();
}

Version check timeout should go to failed state

It's been observed that sometimes (after Safari/macOS upgrade for example) that there is a breakdown in the Safari app extension communication with Aspera Connect. Requests initiated from the app extension end up hanging and never return.

When initialized, the logs show that the app extension is detected, but the init sequence gets stuck when checking for the Aspera Connect version. At this point, the Connect status is still set to INITIALIZING and seems to stay stuck there indefinitely.

We should add a timeout to this version check such that if it does not return within some set period of time (like connectLaunchWaitTimeoutMs) that we immediately go to FAILED so that the web app can properly handle it.

Usually this issue has been seen with clients older than Aspera Connect 4.2.0.

Initial install is not detecting

When initially installing Connect and plugin the RUNNING state takes about 3 minutes to finally be received. A CORS error is shown after plugin install. Possible related.

Worked with @dwosk directly for this error.

AOC issue 1577

ConnectInstaller.showInstall() -> ReferenceError: window is not defined

Description:
I wanted to find out whether the program was installed or not. So I used ConnectInstaller.showInstall() function.
However the build fails because an error occurs: ReferenceError: window is not defined.

Environment:
@ibm-aspera/connect-sdk-js: 5.0.0
Node version: 18.17.0
Browser version: Chrome 121.0.6167.184
Operating System: macOS Sonoma 14.3.1

Example:

'use client';
import { Connect, ConnectInstaller } from "@ibm-aspera/connect-sdk-js";

useLayoutEffect(() => {
    const asperaInstaller = new ConnectInstaller();
    if (typeof window !== 'undefined') {
      Utils.launchConnect((e) => {
        !e && asperaInstaller.showInstall()
        // !e && asperaInstaller.showDownload()
      })
    }
  }, [])

maybe @[email protected]/node_modules/@ibm-aspera/connect-sdk-js/dist/esm/index.js 15:0
-> window.AW4 = __assign(__assign({}, AW4), windowIntegrations);
I think an error occurs here

I am getting this error while using it in React

Uncaught (in promise) Error: Could not start transfer: Error: startTransferPromise: No transfer method is available for starting a transfer
at download (AsperaUpy.jsx:28:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
at invokeGuardedCallback (react-dom.development.js:4277:1)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4291:1)
at executeDispatch (react-dom.development.js:9041:1)
at processDispatchQueueItemsInOrder (react-dom.development.js:9073:1)
at processDispatchQueue (react-dom.development.js:9086:1)
at dispatchEventsForPlugins (react-dom.development.js:9097:1)
at react-dom.development.js:9288:1

Update GH Actions to use approved actions

IBM org now restricts the usage of non-approved actions from the marketplace.

Need to either find replacements or get approvals.

Create GH Release -> move to https://github.com/marketplace/actions/gh-release
Deploy to S3 -> need approval / find verified replacement
NPM Publish -> need approval / find verified replacement
Extract NPM version -> need approval / find verified replacement / do ourselves
Deploy GitHub Pages -> migrate to one of https://github.com/marketplace?category=&type=actions&verification=&query=github+pages.

Expose an option for disabling prevent default handling for drag drop events

It's been observed that native drop events are blocked in some cases in spite of allowPropagation being set to true. The issue seems to be that we prevent default for the drop event, which in certain cases blocks the event.

For example, <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg" />. Dropping a file onto the input element works in isolation. However, when the Connect SDK is used to set a drag drop target onto body, dropping a file onto the input element no longer works because we call preventDefault on the drop event.

In this case, it would be useful to allow clients to set an option to tell the Connect SDK to not call prevent default on the event. Instead, it will be the responsibility of the client to prevent default, since at some point it still needs to be called. Otherwise, dropping a file onto the browser will return in the browser trying to open the file, for example.

Issue about ConnectInstaller

Dear Sir, hope you well , I have some questions,
when I check ConnectInstaller status through below code, asperaInstaller.showDownload() executed, but

  1. "Step 1" show extention has been installed? but actually I didn't install extention
  2. when I click Install Connect, nothing happened.
  3. can I specify the version of Connect ? now it shows {3.9.1}
 const checkAsperaConnectStatus = () => {
        asperaUploadClient = new Connect({ connectMethod: 'http' });
        asperaInstaller = new ConnectInstaller({
            sdkLocation: '//d3gcli72yxqn2z.cloudfront.net/connect/v4'
        });

        asperaUploadClient.addEventListener(Connect.EVENT.STATUS, statusEventListener);
        asperaUploadClient.initSession();
    }



    const statusEventListener = function (eventType, data) {
        if (eventType === Connect.EVENT.STATUS && data === Connect.STATUS.INITIALIZING) {
            console.log('Aspera Connect Client is initializing');
            asperaInstaller.showLaunching();
        } else if (eventType === Connect.EVENT.STATUS && data === Connect.STATUS.FAILED) {
            console.log('Aspera Connect Client failed to load');
            asperaInstaller.showDownload();
        } else if (eventType === Connect.EVENT.STATUS && data === Connect.STATUS.OUTDATED) {
            console.log('Aspera Connect Client is Outdated');
            asperaInstaller.showUpdate();
        } else if (eventType === Connect.EVENT.STATUS && data === Connect.STATUS.RUNNING) {
            console.log('Aspera Connect Client is now Running');
            asperaInstaller.connected();
            asperaUploadClient.removeEventListener(Connect.EVENT.STATUS, statusEventListener);
        }
    };

Capture

Using SDK in React environment - Document or example needed.

Dear dwosk,

May I get example code for SDK in React environment?
Please understand my shortcomings in development.
( I'm really sorry that I could not find the information in this IBM Github documentation as well as https://ibm.github.io/aspera-connect-sdk-js/index.html )


The below example is from my code when using in vanilla Javascript

// These are some of code example for using Connect SDK v4, or 3.11.2 in vanilla Javascript

<script type="text/javascript" src="/resources/connect/v4/asperaweb-4.min.js"></script>
<script type="text/javascript" src="/resources/connect/v4/connectinstaller-4.min.js"></script>


var CONNECT_INSTALLER = "/resources/connect/v4";

asperaWeb = new AW4.Connect({sdkLocation: CONNECT_INSTALLER, pollingTime: 100, minVersion: "3.11.0", dragDropEnabled: true});
connectInstaller = new AW4.ConnectInstaller({sdkLocation: CONNECT_INSTALLER});


let randomId = generateUUID();
const appId = 'aspera_' + randomId;
asperaWeb.initSession(appId);


asperaWeb.addEventListener(AW4.Connect.EVENT.STATUS, statusEventListener);
asperaWeb.addEventListener(AW4.Connect.EVENT.TRANSFER, transferEventListener);


function statusEventListener(eventType, data) {
   if (eventType === AW4.Connect.EVENT.STATUS && data == AW4.Connect.STATUS.INITIALIZING) {
      connectInstaller.showLaunching();
   } else if (eventType === AW4.Connect.EVENT.STATUS && data == AW4.Connect.STATUS.FAILED) {
      connectInstaller.showDownload();
   } else if (eventType === AW4.Connect.EVENT.STATUS && data == AW4.Connect.STATUS.OUTDATED) {
      connectInstaller.showUpdate();
   } else if (eventType === AW4.Connect.EVENT.STATUS && data == AW4.Connect.STATUS.RUNNING) {
      connectInstaller.connected();
   }
};

Issues related to file transfer using Aspera connect.

Hello.
[ Issues ]

This problem is that when you re-download an already existing file as shown in the screenshot below, the download itself proceeds normally, but Aspera Connect SDK's callback and EventListener do not work.

This is a problem that only occurs with ZIP files, and PDF files work fine even if they are downloaded again.

확인-IBM Aspera Connect

대상에 파일 이름이 같은 항목이 이미 있습니다. 계속하시겠습니까?

callback and EventListener are the METHODS below in the IBM_Aspera_Connect_SDK_4.1.0 API documentation.

startTransfer(transferSpec, connectSpec, callbacks)

addEventListener(type, listener)

Please solve this problem

Fonts not found in Installer UI

The Installer UI references the IBM Plex fonts pointing to a local server path /static/media, which does not exist.

Is there anyway to override this path? Or does it mean building a custom UI to avoid this behavior?

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  src: local("IBM Plex Sans"), local("IBMPlexSans"), url(/static/media/IBMPlexSans-Regular-Latin1.edbbba47.woff2) format("woff2");
  unicode-range: U+0000, U+000d, U+0020-007e, U+00a0-00a3, U+00a4-00ff, U+0131, U+0152-0153, U+02c6, U+02da, U+02dc, U+2013-2014, U+2018-201a, U+201c-201e, U+2020-2022, U+2026, U+2030, U+2039-203a, U+2044, U+2074, U+20ac, U+2122, U+2212, U+fb01-fb02
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  src: local("IBM Plex Sans SemiBold"), local("IBMPlexSans-SemiBold"), url(/static/media/IBMPlexSans-SemiBold-Latin1.8af96d78.woff2) format("woff2");
  unicode-range: U+0000, U+000d, U+0020-007e, U+00a0-00a3, U+00a4-00ff, U+0131, U+0152-0153, U+02c6, U+02da, U+02dc, U+2013-2014, U+2018-201a, U+201c-201e, U+2020-2022, U+2026, U+2030, U+2039-203a, U+2044, U+2074, U+20ac, U+2122, U+2212, U+fb01-fb02
}

Remove throw error on getAllTransfers

Request from AoC team to downgrade it to a warning. In some funky situations, it's possible for the Connect status to go from RUNNING to FAILED, triggering this error.

Getting error in Aspera connect when trying to download ~430 files from cloud using Aspera Connect JS SDK

Dear Team,

I am trying to transfer multiple files(~430) in single transfer spec using Aspera Connect JS SDK. All files have common source path. User is common for this transfer. Authentication mechanism is token based. Transfer is happening from S3 bucket to user's local system.
I get error as soon as transfer comes up in transfer list in Connect UI. The error says:
"Token doesn't match file-list/file-pair-list"
When I transfer less number of files (~230), i dont get error and files are downloaded properly.

TransferSpec:
{
authentication: token,
cookie: BatchId: 4F183A67-6BA2-459C-AED2-44532CCE5201,
create_dir: no,
direction: receive,
downloadTransactionId: 21640,
http_fallback: false,
lock_min_rate: no,
lock_target_rate: no,
min_rate_kbps: 5000,
paths: [
{
destination: 474 Files_16GB-04 Dec\WildLife\Other Extension/Datsun.doc,
source: nmdcUCV2DN/20231204/others/328572.doc
},
{
is_truncated_for_logging: true,
reason: to avoid logging too much when a huge number of files is selected
}
],
paths_count: 430,
paths_datafile: C:\Users\abc\AppData\Local\Aspera\Aspera Connect\txfrpaths/72b3e932-825d-478d-8cf6-2aae8b4591f2.json,
remote_host: asperaPublicHost,
remote_user: asperaabc_USER,
resume_check: full_checksum,
ssh_port: 33001,
target_rate_kbps: 10000,
transferType: ASPERA_DOWNLOAD
}

Error log in Aspera client aspera-scp-transfer.0.log file:
2023-12-04 22:58:20.713 [235c-000063ec] ERR Internal error: token/path chunk don't match, token_paths 860, actual paths 544, buffer space used 32726 bytes
2023-12-04 22:58:20.713 [235c-000063ec] ERR Token doesn't match file-list/file-pair-list
Last message repeated 1 times
2023-12-04 22:58:20.713 [235c-23ec] LOG FASP Session Start uuid=4905284f-cf17-40b2-b43a-af665f4285e5 op=recv status=failed errcode=105 errstr="Token doesn't match file-list/file-pair-list" source= dest=C:/Users/abc/Downloads source_prefix=- local=0.0.0.0:64366 peer=10.xxx.x.xx:8888 tcp_port=33001 os="Microsoft Windows 6.2 " ver=4.0.0.182202 lic=6:1:1 peeros="-" peerver=- peerlic=0:0:0 proto_sess=20003 proto_udp=20000 proto_bwmeas=20000 proto_data=2000f

Transfer Token is generated using below command(which has all 430 filepaths):
astokengen --user=S3_USER --path=nmdcUCV2DN/20231204/others/328572.doc --path=nmdcUCV2DN/20231130/others/309815.gch ....--mode=recv

Also checked that the filepaths passed to generate the transfer token are same in number and order as those passed in transfer spec during transfer.

Is there any restriction on the number of files which can be transferred in bulk using Aspera Connect SDK?
Any help on the error will be great.

Thanks in advance.

Produce a standalone Connect SDK

We should be able to ship the Connect SDK separately from the Connect installers. Historically, the Connect SDK has always been a large "bundle" that includes both the Javascript and installer files. The JS should be decoupled from the installers. Some disadvantages of the current Connect SDK bundle:

  1. Can't publish to NPM. The JS and UI communicate via messages, so there's an implied contract between the two that they know how to talk to one another. That the JS loads the UI via an external URL (Cloudfront) makes publishing to NPM tricky.
  2. Because of (1), apps can't take advantage of the Typescript typings available.
  3. Slow updates. Anyone who wants a fix or new feature has to wait for the next release of the Connect application.
  4. Connect SDK is hard to build. Build depends on Connect installers.

Ideally, the standalone Connect SDK would:

  1. Be a single file (connect-sdk.js).
  2. Be installable via NPM or CDN.
  3. Should be able to be deployed whenever we want (nightly/weekly for example).
  4. Render the UI on-demand without loading an external Cloudfront URL.

Aspera SDK - Token issue when developing Javascript.

What we need

  1. How to create and receive tokens using javascript.
  2. Using curl to create permanent (semi-permanent) tokens instead of creating tokens for each file.

Reason.
Problems when generating disposable tokens.

Below is how to create a token that Ravi told you.
Can be created once using curl.

=====================
About test

node account
node id : test
node pw: test

download.json:

{ 
"transfer_requests": [ 
{ "transfer_request": { 
"source_root": "/test", 
"remote_host": "192.168.200.240", 
"paths": [ { "source": "test2.txt" 
} 
] 
} 
} 
] 
}
curl -i -k -X POST -u test:test -d @C:\Users\knp\Desktop\download.json https://192.168.200.240:9092/files/download_setup

HTTP/1.1 200 OK
Cache: no-cache
Connection: close
Content-Type: application/json; charset=utf-8

{
"transfer_specs" : [
{
"transfer_spec" : {
"paths" : [
{
"source" : "test.json"
}
],
"source_root" : "/test/",
"destination_root" : "",
"token" : "ATM2_ACscsRUiIj8bJco62NaQ8c5Qohsasyg3mGs68-tURANUygAAF7QbULy3dbO9E3hI9DcaMD_2MTA",
"direction" : "receive",
"cipher" : "aes-128",
"tags" : null,
"rate_policy_allowed" : "fixed",
"rate_policy" : "fair",
"target_rate_kbps" : 10000,
"min_rate_kbps" : 0,
"remote_host" : "192.168.200.240",
"remote_user" : "test",
"sshfp" : null,
"ssh_port" : 33001,
"fasp_port" : 33001,
"http_fallback" : true,
"http_fallback_port" : 8443
}
}
]
}curl: (56) Failure when receiving data from the peer

JavaScript

function download() {
    const transferSpec = {
      authentication: 'token',
      remote_host: '192.168.200.240',
      remote_user: 'test',
      source_root: '/test',
      paths: [{
        source: 'test2.txt'
    }],
      token: "ATM2_ACscsRUiIj8bJco62NaQ8c5Qohsasyg3mGs68-tURANUygAAF7QbULy3dbO9E3hI9DcaMD_2MTA",
      destination_root: '/',
      direction: 'receive'
    };
    console.log(transferSpec);
    this.client.startTransfer(transferSpec);
  }

    console.log(transferSpec);
    this.client.startTransfer(transferSpec);
  }

When I tested it as above, the file was sent normally.

========================
Using the above method, each time transmission is performed,
a curl token must be generated.
To do that, we need to know how to create tokens with javascript.
Alternatively, we want to know how to create a permanent (semi-permanent) token using curl.

Unable to retrieve transfers when clearing browser cookies/data

Given a transfer initiated by a webpage, when I close the webpage and clear the browser cookies/data but keep the desktop client opened, I'm unable to retrieve any transfer listed in the desktop client either by calling getAllTransfers or binding to the event EVENT.TRANSFER.

Is this an expected behavior? This was reproduced in Chrome 99.0.4844.74 for Windows, connect was successfully initialized after cleaning browser cookies/data and works as expected for new transfers, but all transfers prior to cleaning cookies/data won't get listed by the SDK even when they're listed in the desktop client.

How to receive a message about the transmission status of the file in the web app when transmitting duplicate files to Aspera HSTS using Aspera Connect SDK

Hello.
I am using the WEB APP with built-in Aspera Connect SDK.

When transferring duplicate files to Aspera HSTS using this WEB APP, I confirmed a success message in the activity window of Aspera Connect installed on my PC.

When sending duplicate files to Aspera HSTS in my WEB APP, I am trying to write code to check this status.
When sending a new file to Aspera HSTS, I can see a message to check this status in My WEB APP, but when sending a duplicate file to Aspera HSTS, there is no way to check this status.
In this case, what API can help?

Best regards,
Sook.

Issue reading file using readChunkAsArrayBuffer

I'm facing an issue where the readChunkAsArrayBuffer does not seem to output the expected values. I have an application that is using the Aspera Drag and Drop utility to drop files from the user's local machine. To test the issue I used an html input tag and looped through the file using a normal JS File object and compared chunks of the JS file to the Aspera file. I found that the two blobs are equal until about half way through the file. After that the blobs from the file.splice method and readChunkAsArrayBuffer are no longer equal. It may be important to note that the file is around 5GB in size.

Here's the sample code I used to compare the two files

import {b64toBlob} from "../mediaconch/b64toBlob";
import {asperaWeb} from "../Aspera/AsperaConnect";

function compareFiles(asperaDrapAndDropFile) {
    const CHUNK_SIZE = 1024 * 1024;
    const fileSize = asperaDrapAndDropFile.size;

    const htmlFileInput = document.getElementById('file-input').files[0];

    for (let i = 0; i < asperaDrapAndDropFile.size; i += CHUNK_SIZE) {
        let readSize;

        if (fileSize < i + CHUNK_SIZE) {
            readSize = fileSize - i;
        } else {
            readSize = CHUNK_SIZE;
        }

        const asperaArrayBuffer = await asperaWeb.readChunkAsArrayBuffer(
            {
                path: asperaDrapAndDropFile.name,
                offset: i,
                chunkSize: readSize,
            }
        );

        const asperaBlob = b64toBlob(
            asperaArrayBuffer.data,
            asperaArrayBuffer.type
        );

        const htmlInputBlob = htmlFileInput.slice(i, i + readSize);

        blobsAreEqual(asperaBlob, htmlInputBlob).then(result => {
            if (result) {
                console.log('The loop blobs are equal');
            } else {
                console.log('The loop blobs are not equal');
                console.log('i = ' + i);
                console.log('readSize = ' + readSize);
            }
        });
    }

    function blobsAreEqual(blob1: Blob, blob2: Blob) {
        if (blob1.size !== blob2.size) {
            return new Promise((resolve, reject) => {
                resolve(false); // Blobs are not equal.
                return;
            });
        }

        return new Promise((resolve, reject) => {
            const reader1 = new FileReader();
            const reader2 = new FileReader();

            reader1.onloadend = () => {
                const buffer1 = new Uint8Array(reader1.result);

                reader2.onloadend = () => {
                    const buffer2 = new Uint8Array(reader2.result);

                    for (let i = 0; i < blob1.size; i++) {
                        if (buffer1[i] !== buffer2[i]) {
                            resolve(false); // Blobs are not equal.
                            return;
                        }
                    }
                    resolve(true); // Blobs are equal.
                };

                reader2.readAsArrayBuffer(blob2);
            };

            reader1.readAsArrayBuffer(blob1);
        });
    }
}

Compatibility Aspera HST Endpoint and Aspera Connect SDK

Hello,

Currently, all customers who use the Aspera Connect SDK have installed the Aspera HST Server and are working with the Connect SDK.
We have a server with HST Endpoint 4.4.1 installed, could we use the Aspera Connect SDK with HST endpoint?

Thank you

getting error in React - No transfer method is available for starting a transfer

Dear dwosk,
May I get your advice or support?
..
Extension version 4.1.1
Aspera Connect version 4.2.2
..
My code in App.js in React

import './App.css';
import { Connect, Logger } from '@ibm-aspera/connect-sdk-js';

function testAspera() {
  // Logger.setLevel(2);
  const asperaWeb = new Connect();
  asperaWeb.initSession();

  const transferSpec = {
  paths: [
  {
  source: 'aspera-test-dir-large/100MB'
  }
  ],
  remote_host: 'demo.asperasoft.com',
  remote_user: 'aspera',
  remote_password: 'demoaspera',
  direction: 'receive'
  };

  asperaWeb.startTransfer(transferSpec);
}

function App() {

return (
<div className="App">
<input type="button" value={'test'} onClick={testAspera}/>
</div>
);
}

export default App;

----- Console Logs ---------

AW4.Logger.setLevel(2)
undefined
logger.js:72 [1] Request handler status changing from[undefined] to[INITIALIZING]
logger.js:72 Determining request strategy...
logger.js:72 Attempting extension strategy
logger.js:72 Checking if extension installed...
logger.js:72 Detecting Connect extension. Attempt 1
connect.js:1454 Uncaught Error: startTransfers: No transfer method is available for starting a transfer
    at Connect.startTransfers (connect.js:1454:1)
    at Connect.startTransfer (connect.js:1401:1)
    at testAspera (App.js:21:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
    at invokeGuardedCallback (react-dom.development.js:4277:1)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4291:1)
    at executeDispatch (react-dom.development.js:9041:1)
    at processDispatchQueueItemsInOrder (react-dom.development.js:9073:1)
    at processDispatchQueue (react-dom.development.js:9086:1)
startTransfers @ connect.js:1454
startTransfer @ connect.js:1401
testAspera @ App.js:21
callCallback @ react-dom.development.js:4164
invokeGuardedCallbackDev @ react-dom.development.js:4213
invokeGuardedCallback @ react-dom.development.js:4277
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:4291
executeDispatch @ react-dom.development.js:9041
processDispatchQueueItemsInOrder @ react-dom.development.js:9073
processDispatchQueue @ react-dom.development.js:9086
dispatchEventsForPlugins @ react-dom.development.js:9097
(익명) @ react-dom.development.js:9288
batchedUpdates$1 @ react-dom.development.js:26140
batchedUpdates @ react-dom.development.js:3991
dispatchEventForPluginEventSystem @ react-dom.development.js:9287
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ react-dom.development.js:6465
dispatchEvent @ react-dom.development.js:6457
dispatchDiscreteEvent @ react-dom.development.js:6430
react-dom.development.js:4161 [Violation] 'click' handler took 8924ms
connect.js:1454 Uncaught Error: startTransfers: No transfer method is available for starting a transfer
    at Connect.startTransfers (connect.js:1454:1)
    at Connect.startTransfer (connect.js:1401:1)
    at testAspera (App.js:21:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
    at invokeGuardedCallback (react-dom.development.js:4277:1)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4291:1)
    at executeDispatch (react-dom.development.js:9041:1)
    at processDispatchQueueItemsInOrder (react-dom.development.js:9073:1)
    at processDispatchQueue (react-dom.development.js:9086:1)
startTransfers @ connect.js:1454
startTransfer @ connect.js:1401
testAspera @ App.js:21
callCallback @ react-dom.development.js:4164
invokeGuardedCallbackDev @ react-dom.development.js:4213
invokeGuardedCallback @ react-dom.development.js:4277
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:4291
executeDispatch @ react-dom.development.js:9041
processDispatchQueueItemsInOrder @ react-dom.development.js:9073
processDispatchQueue @ react-dom.development.js:9086
dispatchEventsForPlugins @ react-dom.development.js:9097
(익명) @ react-dom.development.js:9288
batchedUpdates$1 @ react-dom.development.js:26140
batchedUpdates @ react-dom.development.js:3991
dispatchEventForPluginEventSystem @ react-dom.development.js:9287
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ react-dom.development.js:6465
dispatchEvent @ react-dom.development.js:6457
dispatchDiscreteEvent @ react-dom.development.js:6430
[Violation] 'click' handler took 20488ms
logger.js:72 Extension detected: {"type":"AsperaConnectCheckResponse","detail":{"extension_version":"4.1.1.1"}}
logger.js:72 Detecting Connect installation via extension. Attempt 1
logger.js:72 {request_id: 10500, min_version: '', method: 'GET', uri_reference: '/connect/info/version', body: ''}
logger.js:72 Native host impl received response: {"request_id":10500,"object_id":0,"frame_id":"63cc53e1-6d81-496e-b0c0-6cbcf4e5b352","status":200,"body64":"eyAic3lzdGVtX3dpZGUiIDogdHJ1ZSwgInZlcnNpb24iIDogIjQuMi4yLjEzNSIgfQ==","sender":{"id":"kpoecbkildamnnchnlgoboipnblgikpn","tab":{"id":1623070870},"url":"http://localhost:3000/","origin":"http://localhost:3000"},"complete":true,"name":"AsperaConnectResponse"}
logger.js:72 Detected Connect installation via extension.
logger.js:72 {request_id: 10000, min_version: '', method: 'GET', uri_reference: '/connect/info/version', body: ''}
logger.js:72 nmh init finished
logger.js:72 Connect initialized. Checking version now.
logger.js:72 {request_id: 10001, min_version: '', method: 'GET', uri_reference: '/connect/info/version', body: ''}
logger.js:72 Native host impl received response: {"request_id":10000,"object_id":0,"frame_id":"63cc53e1-6d81-496e-b0c0-6cbcf4e5b352","status":200,"body64":"eyAic3lzdGVtX3dpZGUiIDogdHJ1ZSwgInZlcnNpb24iIDogIjQuMi4yLjEzNSIgfQ==","sender":{"id":"kpoecbkildamnnchnlgoboipnblgikpn","tab":{"id":1623070870},"url":"http://localhost:3000/","origin":"http://localhost:3000"},"complete":true,"name":"AsperaConnectResponse"}
logger.js:72 [1] Request handler status changing from[INITIALIZING] to[RUNNING]
logger.js:72 Request queue empty.
logger.js:72 Resetting max activity outstanding.
logger.js:72 [1] Connect status changing from[INITIALIZING] to[RUNNING]
logger.js:72 Connect API is ready.

Thanks and best regards.
KJ.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.