> 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/arweave.md).

# Arweave

Dive into the specifics of connecting and using Arweave with web3stash

## Initialization

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

```javascript
const arweaveService = Web3Stash("ARWEAVE",{arweavePrivateKey:""},{Arweave APIconfig options})
```

## Configuration&#x20;

To use Arweave in web3stash, you need one thing:

* arweavePrivateKey - PrivateKey to be used to sign transactions

There are some other important config options you might like to pass like host, port, protocol, etc. Those need to be passed in configOptions, the third Parameter.&#x20;

Note: Use these names only while passing keys in object i.e, {arweavePrivateKey:"",}

#### Optional Config Options

You can pass config options that are available with Arweave service- You can check Arweave docs to check what config options are there that you can pass while initializing arweave

```
{
    host?: string;
    protocol?: string;
    port?: string | number;
    timeout?: number;
    logging?: boolean;
    logger?: Function;
    network?: string;
}
```

Default values are set for

* host= arweave.net
* port=443
* protocol=https
* others as per arweave default values

## Methods Available

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

* Uploading JSON data&#x20;

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

* Uploading Image

```javascript
arweaveService.uploadImage("./image.png", {arwweaveOptions}).then().catch()
```

* Uploading Video

```javascript
arweaveService.uploadVideo("./video.mp4", {arweaveOptions}).then().catch()
```

* Uploading File

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

* Uploading Images from Stream

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

* Uploading Video from Stream

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

* Uploading File from Stream

<pre class="language-javascript"><code class="lang-javascript"><strong>arweaveService.uploadFileFromStream(readableStream, 1024, "txt", {arweaveOptions}).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>
