# arrakis-js

Arrakis Javascript client library

---

## Installation

Install it in your project with `node`:

```
npm install arrakis-js
```

Or if you prefer loading from a CDN:

``` html
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/arrakis-js/dist/arrakis.min.js"></script>
```

## Features

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

## Quickstart

### Stream timeseries

##### 1. Live data

``` javascript
import * from 'arrakis'

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

for (block of arrakis.stream(channels)) {
	console.log(block)
};
```

##### 2. Historical data

``` javascript
import * from 'arrakis'

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

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

### Describe metadata

``` javascript
import * from 'arrakis'

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

metadata = arrakis.describe(channels)
```

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

### Find channels

``` javascript
import * from 'arrakis'

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

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

### Count channels

``` javascript
import * from 'arrakis'

count = arrakis.count("H1:LSC-*")
```
