arrakis-js
v0.1.8
Published
Arrakis Javascript client library
Downloads
52
Maintainers
Readme
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-jsCDN
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 eventsourceFeatures
- 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-*");