@deephaven/jsapi-nodejs
TypeScript icon, indicating that this package has built-in type declarations

0.109.0 • Public • Published

@deephaven/jsapi-nodejs

Deephaven utils for consuming Jsapi from a server from a nodejs app. The jsapi can be downloaded as an ESM or CJS module.

Install

npm install --save @deephaven/jsapi-nodejs

Usage

import fs from 'node:fs';
import path from 'node:path';

import { loadDhModules } from '@deephaven/jsapi-nodejs';

// Needed for esm modules
if (typeof globalThis.__dirname === 'undefined') {
  globalThis.__dirname = import.meta.dirname
}

const tmpDir = path.join(__dirname, 'tmp');

// Download jsapi from a Deephaven server
const dhc = await loadDhModules({
  serverUrl: new URL('http://localhost:10000'),
  storageDir: tmpDir,
  targetModuleType: 'esm', // set to `cjs` to download as a CommonJS module
});

const client = new dhc.CoreClient(serverUrl.href, {
  // Enable http2 transport (this is optional but recommended)
  transportFactory: NodeHttp2gRPCTransport.factory,
})

await client.login({
  type: dhc.CoreClient.LOGIN_TYPE_ANONYMOUS,
})

const cn = await client.getAsIdeConnection()

/@deephaven/jsapi-nodejs/

    Package Sidebar

    Install

    npm i @deephaven/jsapi-nodejs

    Weekly Downloads

    295

    Version

    0.109.0

    License

    Apache-2.0

    Unpacked Size

    80.6 kB

    Total Files

    31

    Last publish

    Collaborators

    • vbabich
    • mofojed
    • mikebender
    • niloc132
    • nbauernfeind
    • jnumainville
    • deephaven-bot
    • bingles