> For the complete documentation index, see [llms.txt](https://blocknote-js.gitbook.io/doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blocknote-js.gitbook.io/doc/blocknote/data-streaming/streamnotemanager.md).

# StreamnoteManager

The `StreamnoteManager` is a simple store for `Streamnote` instances.\
It simplifies the use of `Streamnote` behind an API and/or when dealing with multiple streams.

Example of use:

```javascript
import  {Streamnote, StreamnoteManager} from  "blocknote"

// Create a new Streamnote instance and save it into the store.
// Returns the UUID of the stored Streamnote instance & its payload_transaction_id
app.post('/create-new-stream', async (req, res) => {
    
    const options                = req.body?.options; // title, compression, encryption ...
    options.onFinish             = (result) => {
        //Do something with the result when stream ends.
    }
    options.onError              = (error) => {
        //Do something when an error happened.
    }
    const sender_mnemonic        = "gorilla shiver hood theory letter absorb arctic ...";
    const stream                 = new Streamnote(sender_mnemonic, options);
    const uuid                   = StreamnoteManager.store(stream);
    const payload_transaction_id = await StreamnoteManager.getPayloadTransactionId(uuid);
    
    res.send({uuid, payload_transaction_id});
});

// Send data on the given stream identified by the UUID.
app.post('/send/:uuid', (req, res) => {
    
    const uuid = req.params.uuid;
    const data = req.body.data;
   
    StreamnoteManager.send(uuid, data);
   
    res.send(true);
});

// Stop the stream identified by the UUID.
app.post('/stop/:uuid', (req, res) => {
    
    const uuid = req.params.uuid;
    
    StreamnoteManager.stop(uuid);
   
    res.send(true);
});

// List all the stored Streamnote instance(s).
app.get('/list', async (req, res) => {
            
    const list = await StreamnoteManager.list();
   
    res.send(list);
});

```

***

## Methods

### <mark style="color:$primary;">store</mark>

#### Parameters

<table><thead><tr><th width="192">Name</th><th width="316">Description</th><th>Type</th></tr></thead><tbody><tr><td>streamnote_instance</td><td>An instance of <code>Streamnote</code></td><td><code>Streamnote</code></td></tr></tbody></table>

#### Return

A UUID that uniquely identifies the `Streamnote` instance in the store.

### <mark style="color:$primary;">get</mark>

#### Parameters

<table><thead><tr><th width="100">Name</th><th width="520">Description</th><th>Type</th></tr></thead><tbody><tr><td>uuid</td><td>The UUID of the stored <code>Streamnote</code> instance</td><td>string</td></tr></tbody></table>

#### Return

The `Streamnote` instance stored under this UUID.

***

### <mark style="color:$primary;">send</mark>

#### Parameters

<table><thead><tr><th width="98">Name</th><th width="413">Description</th><th>Type</th></tr></thead><tbody><tr><td>uuid</td><td>The UUID of the stored <code>Streamnote</code> instance</td><td>string</td></tr><tr><td>data</td><td>The data to send on the stream</td><td>string, Uint8Array, Buffer</td></tr></tbody></table>

#### Return

`null`

***

### <mark style="color:$primary;">stop</mark>

#### Parameters

<table><thead><tr><th width="98">Name</th><th width="413">Description</th><th>Type</th></tr></thead><tbody><tr><td>uuid</td><td>The UUID of the stored <code>Streamnote</code> instance</td><td>string</td></tr></tbody></table>

#### Return

`null`, triggers the `onFinish()` callback of the `Streamnote` instance.
