# brayns

> > A JavaScript/TypeScript interface for interacting with the [Brayns](https://github.com/BlueBrain/Brayns) rendering service.

Latest version **0.8.0** (published 2019-02-26) · LGPL-3.0+ license · 0 weekly downloads

## Install

```sh
npm install brayns
pnpm add brayns
yarn add brayns
bun add brayns
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.0 |
| Published | 2019-02-26 |
| First published | 2019-01-22 |
| Weekly downloads | 0 |
| License | LGPL-3.0+ |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 8.15 |
| Dependencies | 4 |
| Unpacked size | 516.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Roland Groza |
| Maintainers | rolandjitsu |

## Links

- npm: https://www.npmjs.com/package/brayns
- Repository: https://github.com/BlueBrain/Brayns
- Issues: https://github.com/BlueBrain/Brayns/issues
- npm.io page: https://npm.io/package/brayns

## Dependencies (4)

- [tslib](https://npm.io/package/tslib.md) ^1.9.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.10
- [rxjs-file](https://npm.io/package/rxjs-file.md) ^0.2.0
- [crypto-uid](https://npm.io/package/crypto-uid.md) ^0.3.0

## Recent versions

- 0.8.0 (latest) — 2019-02-26
- 0.1.0 — 2019-01-22

## README

# Brayns JavaScript/TypeScript Client

> A JavaScript/TypeScript interface for interacting with the [Brayns](https://github.com/BlueBrain/Brayns) rendering service.


# Table of Contents

* [Installation](#installation)
* [Usage](#usage)


### Installation
----------------
You can install this package from [NPM](https://www.npmjs.com):
```bash
npm add rxjs rockets-client brayns
```

Or with [Yarn](https://yarnpkg.com/en):
```bash
yarn add rxjs rockets-client brayns
```

*NOTE*: [TypeScript](https://www.typescriptlang.org) type definitions are bundled with the package.


### Usage
---------
Create a client and connect:
```ts
import {Client} from 'brayns';
import {take} from 'rxjs/operators';

const brayns = new Client('myhost');
await brayns.ready.pipe(take(1))
    .toPromise();
```

Listen to server notifications:
```ts
import {Client, PROGRESS} from 'brayns';

const brayns = new Client('myhost');

brayns.observe(PROGRESS)
    .subscribe(progress => {
        console.log(progress);
    });
```

Send notifications:
```ts
import {CANCEL, Client} from 'brayns';

const brayns = new Client('myhost');
await brayns.ready.pipe(take(1))
    .toPromise();

brayns.notify(CANCEL, {
    id: 1 // some request id
});
```

Make a request:
```ts
import {Client, GET_STATISTICS} from 'brayns';

const brayns = new Client('myhost');
await brayns.ready.pipe(take(1))
    .toPromise();

const statistics = await brayns.request(GET_STATISTICS);
console.log(statistics);
```

Upload a model:
```ts
import {Client} from 'brayns';

const brayns = new Client('myhost');
await brayns.ready.pipe(take(1))
    .toPromise();

// Usually we get the file from user input
const file = new File([]);

await brayns.upload({file});
```

---
_Source: https://npm.io/package/brayns · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
