Options
All
  • Public
  • Public/Protected
  • All
Menu

IBM Aspera Browser JavaScript Library

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

ActivityMessageTypes

ActivityMessageTypes: "transferUpdated" | "transferRemoved"

OverwritePolicy

OverwritePolicy: "none" | "always" | "diff" | "older" | "diff+older"

ResumePolicy

ResumePolicy: "none" | "attributes" | "sparse_checksum" | "full_checksum"

SafariExtensionEvent

SafariExtensionEvent: "ENABLED" | "DISABLED"

TransferStatus

TransferStatus: "failed" | "completed" | "running" | "queued" | "removed" | "canceled" | "orphaned" | "paused"

WebsocketEvent

WebsocketEvent: "CLOSED" | "RECONNECT"

WebsocketTopics

WebsocketTopics: "subscribe_transfer_activity" | "transfer_activity"

Variables

Const asperaBrowser

asperaBrowser: Browser = new Browser()

Const client

client: Client = isSafari() ? safariClient : httpClient

Const httpClient

httpClient: HttpClient = new HttpClient()

Let keepAliveTimeout

keepAliveTimeout: ReturnType<typeof setTimeout>

Global keep alive timeout to prevent recursion.

Const launch

launch: launch = asperaBrowser.globals.launch

Const safariClient

safariClient: SafariClient = new SafariClient()

Const websocketService

websocketService: WebsocketService = new WebsocketService()

Functions

Const apiGet

  • apiGet(url: string): Promise<any>
  • Make a GET for retrieving data from a server

    Parameters

    • url: string

      the url string of the resource on the server

    Returns Promise<any>

    a promise that will resolve with the response from the server or reject if network/server error

Const createDropzone

  • createDropzone(callback: (data: { event: any; files: DataTransferResponse }) => void, elementSelector: string): void
  • Create a dropzone for the given element selector.

    Parameters

    Returns void

Const deregisterActivityCallback

  • deregisterActivityCallback(id: string): void
  • Remove a callback from the transfer callback

    Parameters

    • id: string

      the ID returned by registerActivityCallback

    Returns void

Const deregisterRemovedCallback

  • deregisterRemovedCallback(id: string): void
  • Remove a callback from the removed transfer callback

    Parameters

    • id: string

      the ID returned by registerRemovedCallback

    Returns void

Const deregisterSafariExtensionStatusCallback

  • deregisterSafariExtensionStatusCallback(id: string): void
  • Remove a callback from getting Safari extension status events.

    Parameters

    • id: string

      the ID returned by registerStatusCallback

    Returns void

Const deregisterStatusCallback

  • deregisterStatusCallback(id: string): void
  • Remove a callback from getting connection status events.

    Parameters

    • id: string

      the ID returned by registerStatusCallback

    Returns void

Const errorLog

  • errorLog(message: string, debugData?: any): void
  • Log errors from Aspera Browser SDK

    Parameters

    • message: string

      the message indicating the error encountered

    • Optional debugData: any

      the data with useful debugging information

    Returns void

Const generateErrorBody

  • generateErrorBody(message: string, debugData?: any): ErrorResponse
  • Generate error object for rejecter responses

    Parameters

    • message: string

      the message indicating the error encountered

    • Optional debugData: any

      the data with useful debugging information

    Returns ErrorResponse

    object containing standardized error response

Const generatePromiseObjects

  • Generates promise object that can be resolved or rejected via functions

    Returns PromiseObject

    an object containing the promise, the resolver and rejecter

Const getAllTransfers

  • Get all transfers associated with the current application.

    Returns Promise<BrowserTransfer[]>

    a promise that resolves with an array of transfers.

Const getCurrentPlatform

  • getCurrentPlatform(): "macos" | "windows" | "linux" | "unknown"
  • Simple function to get the current platform.

    Returns "macos" | "windows" | "linux" | "unknown"

    a string indicating the current platform

Const getInfo

  • Get metadata about the IBM Aspera Browser installation.

    Returns Promise<BrowserInfo>

    a promise that returns information about the user's IBM Aspera Browser installation.

Const getInstallerInfo

  • Get the latest Aspera Browser installer information such as download URL and version.

    Parameters

    Returns Promise<InstallerInfoResponse>

    a promise that resolves with the installer info and rejects if there is an error

Const getRpcServerUrl

  • getRpcServerUrl(): string

Const getTransfer

  • Get a specific transfer by ID.

    Parameters

    • id: string

      transfer uuid

    Returns Promise<BrowserTransfer>

    a promise that resolves with the transfer.

Const getWebsocketUrl

  • getWebsocketUrl(serverUrl: string): string
  • Returns a string indicating the websocket URL to use for talking to the server

    Parameters

    • serverUrl: string

    Returns string

    a string of the full Websocket URL

Const handlePromiseErrors

  • handlePromiseErrors(promise: Promise<any>): Promise<any>
  • Check HTTP promise response for server error response (non 2XX status) and reject promise is error

    Parameters

    • promise: Promise<any>

      the HTTP promise to check for HTTP status code of 2XX for success

    Returns Promise<any>

    promise for the HTTP connection with catch supporting error

Const handlePromiseLikeErrors

  • handlePromiseLikeErrors(promise: PromiseLike<any>): Promise<any>
  • Wraps a promise like object and returns a promise that supports catch.

    Parameters

    • promise: PromiseLike<any>

      the HTTP promise like to wrap

    Returns Promise<any>

    promise for the HTTP connection with catch supporting error

Const init

  • Initialize IBM Aspera Browser client. If client cannot (reject/catch), then client should attempt fixing server URL or trying again. If still fails disable UI elements.

    Parameters

    • Optional options: InitOptions

      initialization options:

      • appId the unique ID for the website. Transfers initiated during this session will be associated with this ID. It is recommended to use a unique ID to keep transfer information private from other websites.

      • supportMultipleUsers when enabled (defaults to false), the SDK will iterate over a port range and generate a session id to determine the running instance of the desktop app for the current user. This is needed when multiple users may be logged into the same machine simultaneously, for example on a Windows Server.

    Returns Promise<any>

    a promise that resolves if IBM Aspera Desktop is running properly or rejects if unable to connect

Const initDragDrop

  • initDragDrop(): Promise<boolean>
  • Initialize drag and drop.

    Returns Promise<boolean>

    a promise that resolves if the initialization was successful or not

Const isSafari

  • isSafari(): boolean
  • Checks if the current browser is Safari.

    Returns boolean

    Whether the browser is Safari.

Const isValidTransferSpec

  • Validate if transferSpec is valid for server communication

    Parameters

    Returns boolean

    boolean indicating whether supplied transferSpec is valid

Const isValidURL

  • isValidURL(url: string): boolean
  • Check if the given string is a valid URL

    Parameters

    • url: string

      string to check if valid URL

    Returns boolean

    boolean

Const modifyTransfer

  • Modify the speed of a running transfer.

    Parameters

    Returns Promise<BrowserTransfer>

    a promise that resolves if the transfer rate can be modified and rejects if not

Const randomUUID

  • randomUUID(): string

Const registerActivityCallback

  • registerActivityCallback(callback: (transfers: TransferResponse) => void): string
  • Register a callback event for getting transfer updates

    Parameters

    Returns string

    ID representing the callback for deregistration purposes

Const registerRemovedCallback

  • registerRemovedCallback(callback: (transfer: BrowserTransfer) => void): string
  • Register a callback event for when a user removes or cancels a transfer directly from IBM Aspera Browser. This may also be called if IBM Aspera Browser is configured to automatically remove completed transfers.

    Parameters

    Returns string

    ID representing the callback for deregistration purposes

Const registerSafariExtensionStatusCallback

  • Register a callback for getting updates about the Safari extension status.

    This can be useful if you want to handle the case where the user enable or disable the Safari extension.

    Parameters

    Returns string

    ID representing the callback for deregistration purposes

Const registerStatusCallback

  • registerStatusCallback(callback: (status: WebsocketEvent) => void): string
  • Register a callback for getting updates about the connection status of IBM Aspera Browser.

    For example, to be notified of when the SDK loses connection with the application or connection is re-established. This can be useful if you want to handle the case where the user quits IBM Aspera Browser after init has already been called, and want to prompt the user to relaunch the application.

    Parameters

    Returns string

    ID representing the callback for deregistration purposes

Const removeDropzone

  • removeDropzone(elementSelector: string): void
  • Remove dropzone.

    Parameters

    • elementSelector: string

      the selector of the element on the page that should remove

    Returns void

Const removeTransfer

  • removeTransfer(id: string): Promise<any>
  • Remove a transfer. This will stop the transfer if it is in progress.

    Parameters

    • id: string

      transfer uuid

    Returns Promise<any>

    a promise that resolves if transfer is removed and rejects if transfer cannot be removed

Const resumeTransfer

  • Resume a paused or failed transfer.

    Parameters

    Returns Promise<BrowserTransfer>

    a promise that resolves with the new transfer object if transfer is resumed

Const setBranding

  • Set the custom branding template to be used by IBM Aspera Browser. If the app is already configured to use a different branding, then the branding template you specify will be stored by the app, allowing the end user to switch at any point.

    Parameters

    • id: string

      custom branding template id. This should be consistent across page loads.

    • options: CustomBrandingOptions

      custom branding options

    Returns Promise<any>

    a promise that resolves if the branding was properly set.

Const showDirectory

  • showDirectory(id: string): Promise<any>
  • Opens and highlights the downloaded file in Finder or Windows Explorer. If multiple files, then only the first file will be selected.

    Parameters

    • id: string

      transfer uuid

    Returns Promise<any>

    a promise that resolves if the file can be shown and rejects if not

Const showPreferences

  • showPreferences(): Promise<any>
  • Opens the IBM Aspera Browser preferences page.

    Returns Promise<any>

    a promise that resolves when the preferences page is opened.

Const showSelectFileDialog

  • Displays a file browser dialog for the user to select files.

    Parameters

    Returns Promise<DataTransferResponse>

    a promise that resolves with the selected file(s) and rejects if user cancels dialog

Const showSelectFolderDialog

  • Displays a folder browser dialog for the user to select folders.

    Parameters

    Returns Promise<DataTransferResponse>

    a promise that resolves with the selected folder(s) and rejects if user cancels dialog

Const startTransfer

  • Start a transfer

    Parameters

    • transferSpec: TransferSpec

      standard transferSpec for transfer

    • browserSpec: BrowserSpec

      IBM Aspera Browser settings when starting a transfer

    Returns Promise<BrowserTransfer>

    a promise that resolves if transfer initiation is successful and rejects if transfer cannot be started

Const stopTransfer

  • stopTransfer(id: string): Promise<any>
  • Stop a transfer.

    Parameters

    • id: string

      transfer uuid

    Returns Promise<any>

    a promise that resolves if transfer is stopped and rejects if transfer cannot be stopped

Const testConnection

  • testConnection(): Promise<any>
  • Check if IBM Aspera for Desktop connection works. This function is called by init when initializing the SDK. This function can be used at any point for checking.

    Returns Promise<any>

    a promise that resolves if server can connect or rejects if not

Const throwError

  • throwError(message: string, debugData?: any): Promise<any>
  • Return a rejected promise

    Parameters

    • message: string

      the message indicating the error encountered

    • Optional debugData: any

      the data with useful debugging information

    Returns Promise<any>

    a rejected promise