> For the complete documentation index, see [llms.txt](https://theblockchainchief.gitbook.io/web3stash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://theblockchainchief.gitbook.io/web3stash/services/bundlr-arweave.md).

# Bundlr(Arweave)

Dive into the specifics of connecting and using Bundlr(Arweave) with web3stash

## Initialization

To use Bundlr you have to pass "BUNDLR" as the service name. No other name will work!

```javascript
const bundlrService = Web3Stash("BUNDLR",{currency:"", privateKey:"", testing:false},{Bundlr APIconfig options})
```

## Configuration&#x20;

To use Bundlr in web3stash, you need three things:

* currency - Currency You want to use for transactions(Check Bundlr Docs)
* privateKey - PrivateKey to be used to sign transactions
* testing- This is optional, Default is false, If you are testing set it to true so that it uses the testing node of bundlr

Note: Use these names only while passing keys in object i.e, {currency:"", privateKey:"", testing:true}

#### Optional Config Options

You can pass config options that is available with bundlr service- You can check bundlr docs to check what config options are there which you can pass while initialising bundlr

```javascript
{timeout?: number | undefined; providerUrl?: string | undefined; contractAddress?: string | undefined; currencyOpts?: any}
```

## Methods Available

The following methods are available for this service, More will be added soon

* Uploading JSON data&#x20;

```javascript
bundlrService.uploadJson({name:"example", url:"abc.com"}, {bundlrOptions}).then().catch()
```

* Uploading Image

```javascript
bundlrService.uploadImage("./image.png", {bundlrOptions}).then().catch()
```

* Uploading Video

```javascript
bundlrService.uploadVideo("./video.mp4", {bundlrOptions}).then().catch()
```

* Uploading File

<pre class="language-javascript"><code class="lang-javascript"><strong>bundlrService.uploadFile("./data.txt", {bundlrOptions}).then().catch()
</strong></code></pre>

* Uploading Images from Stream

<pre class="language-javascript"><code class="lang-javascript"><strong>bundlrService.uploadImageFromStream(readableStream, 1024, "png", {bundlrOptions}).then().catch()
</strong></code></pre>

* Uploading Video from Stream

<pre class="language-javascript"><code class="lang-javascript"><strong>bundlrService.uploadVideoFromStream(readableStream, 1024, "mp4", {bundlrOptions}).then().catch()
</strong></code></pre>

* Uploading File from Stream

<pre class="language-javascript"><code class="lang-javascript"><strong>bundlrService.uploadFileFromStream(readableStream, 1024, "txt", {bundlrOptions}).then().catch()
</strong></code></pre>

## Output

All the functions return id (cid) and metadata (data returned by the service on upload)

<pre class="language-javascript"><code class="lang-javascript"><strong>{id:"dewfnlpweurmwknrwiojhgcbxczz", metadata:{}}
</strong></code></pre>
