arrakis-js
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

arrakis-js

Arrakis Javascript client library


Installation

This library is built as an ES module and works in both browser and Node.js environments.

npm/yarn/pnpm

npm install arrakis-js
# or
yarn add arrakis-js
# or
pnpm add arrakis-js

CDN

For browser usage, you can load the library directly from a CDN:

<script type="module">
  import * as arrakis from 'https://cdn.jsdelivr.net/npm/arrakis-js/dist/index.js';
</script>

Or as a traditional script (creates global arrakis object):

<script src="https://cdn.jsdelivr.net/npm/arrakis-js/dist/arrakis.min.js"></script>

Node.js

For Node.js projects, you can use dynamic imports:

const arrakis = await import('arrakis-js');

Note: The find() function requires an EventSource polyfill in Node.js:

npm install eventsource

Features

  • Query live and historical timeseries data
  • Describe channel metadata
  • Search for channels matching a set of conditions

Quickstart

Stream timeseries

1. Live data
import * as arrakis from 'arrakis-js';

const channels = [
    "H1:CAL-DELTAL_EXTERNAL_DQ",
    "H1:LSC-POP_A_LF_OUT_DQ",
];

for await (const block of arrakis.stream(channels)) {
	console.log(block);
}
2. Historical data
import * as arrakis from 'arrakis-js';

const start = 1187000000;
const end = 1187001000;
const channels = [
    "H1:CAL-DELTAL_EXTERNAL_DQ",
    "H1:LSC-POP_A_LF_OUT_DQ",
];

for await (const block of arrakis.stream(channels, start, end)) {
    console.log(block);
}

Describe metadata

import * as arrakis from 'arrakis-js';

const channels = [
    "H1:CAL-DELTAL_EXTERNAL_DQ",
    "H1:LSC-POP_A_LF_OUT_DQ",
];

const metadata = await arrakis.describe(channels);

where metadata is a dictionary mapping channel names to [arrakis.channel.Channel][].

Find channels

import * as arrakis from 'arrakis-js';

for await (const channel of arrakis.find("H1:LSC-*")) {
    console.log(channel);
}

where channel is a [arrakis.channel.Channel][].

Count channels

import * as arrakis from 'arrakis-js';

const count = await arrakis.count("H1:LSC-*");

/arrakis-js/

    Package Sidebar

    Install

    npm i arrakis-js

    Weekly Downloads

    91

    Version

    0.1.6

    License

    LGPL-3.0-or-later

    Unpacked Size

    2.07 MB

    Total Files

    14

    Last publish

    Collaborators

    • martinberoiz