# arweave-archive

> A node package to archive webpage & it's screenshot to Arweave

Latest version **0.0.16** (published 2023-06-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install arweave-archive
pnpm add arweave-archive
yarn add arweave-archive
bun add arweave-archive
```

## 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.0.16 |
| Published | 2023-06-24 |
| First published | 2023-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 5 |
| Unpacked size | 37.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Pawan Paudel |
| Maintainers | pawanpaudel93 |
| Keywords | web3, arweave-archive, arweave, bundlr |

## Links

- npm: https://www.npmjs.com/package/arweave-archive
- Repository: https://github.com/pawanpaudel93/arweave-archive
- Homepage: https://github.com/pawanpaudel93/arweave-archive#readme
- Issues: https://github.com/pawanpaudel93/arweave-archive/issues
- Funding: https://github.com/sponsors/pawanpaudel93
- npm.io page: https://npm.io/package/arweave-archive

## Dependencies (5)

- [axios](https://npm.io/package/axios.md) ^1.4.0
- [arweave](https://npm.io/package/arweave.md) ^1.13.7
- [arbundles](https://npm.io/package/arbundles.md) ^0.9.6
- [mime-types](https://npm.io/package/mime-types.md) ^2.1.35
- [save-html-screenshot](https://npm.io/package/save-html-screenshot.md) ^0.0.15

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.0.16 (latest) — 2023-06-24
- 0.0.15 — 2023-06-23
- 0.0.14 — 2023-06-22
- 0.0.13 — 2023-06-19
- 0.0.12 — 2023-06-17
- 0.0.11 — 2023-06-16
- 0.0.10 — 2023-06-16
- 0.0.9 — 2023-06-16
- 0.0.8 — 2023-06-08
- 0.0.7 — 2023-06-08
- 0.0.6 — 2023-06-01
- 0.0.5 — 2023-05-20
- 0.0.4 — 2023-05-19
- 0.0.3 — 2023-05-19
- 0.0.2 — 2023-05-17
- … 1 more at https://npm.io/package/arweave-archive/versions

## README

# arweave-archive

arweave-archive is a node package that allows you to archive webpage and screenshot of the desired url on the [Arweave](https://arweave.org) blockchain. It provides a convenient way to store web content permanently and securely.

[![NPM version](https://img.shields.io/npm/v/arweave-archive?color=green&label=npm-package)](https://www.npmjs.com/package/arweave-archive)

## Installation

Using npm,

```sh
npm install arweave-archive
```

Using yarn,

```sh
yarn add arweave-archive
```

Using pnpm,

```sh
pnpm add arweave-archive
```

## Usage

To use the Arweave Archive package, import it and create an instance of the `ArweaveArchiver` class. You need to provide a JSON Web Key (JWK) or a path to a JWK file, which will be used to sign transactions. Optionally, you can also provide the gateway and bundler URLs and browserless options. If browserless options is not provided, locally installed Chrome browser is used to capture the webpage and screenshot of the provided url using puppeteer.

```ts
import { ArweaveArchiver } from 'arweave-archive'

const jwk = '<your-jwk-file-path-or-data>'
const options = {
  gatewayUrl: 'https://arweave.net',
  bundlerUrl: 'https://node2.bundlr.network',
}

const archiver = new ArweaveArchiver(jwk, options)
```

### Configuration

The `ArweaveArchiver` class allows you to configure the following options:

- `gatewayUrl` (optional): The URL of the Arweave gateway to use for uploading and accessing archived webpages. (default: '<https://arweave.net>')
- `bundlerUrl` (optional): The URL of the Arweave bundler to use for bundling and uploading archives. (default: '<https://node2.bundlr.network>')
- `browserOptions` (optional): [HtmlScreenshotSaverOptions](https://github.com/pawanpaudel93/save-html-screenshot/blob/fd689be68ceeb5eafc8622f6a1542843870de91d/src/types.ts#L44C1-L44C1)

Here's an example of how you can set the browserOptions:

```ts
const options = {
  browserHeadless: true,
  userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
  browserHeight: 1080,
  browserWidth: 1920,
  browserlessOptions: {
    apiKey: 'your-api-key',
    blockAds: true,
    stealth: true,
    userDataDir: 'your-user-data-dir',
    keepalive: 60000,
    ignoreDefaultArgs: '--disable-extensions',
    timeout: 60000
  }
}

const archiver = new ArweaveArchiver(jwk, options)
```

Please note that the browserlessOptions is optional, and you can omit them if you don't need to use it for capturing webpage and screenshots of the provided url.

### Archiving a URL

You can archive a webpage by providing its URL to the `archiveUrl` method. The method returns a promise that resolves to an `ArchiveResult` object, containing the status of the archive process, a message, the transaction ID, the title of the webpage, and the timestamp.

```ts
const output = await archiver.archiveUrl('https://github.com/pawanpaudel93')
console.log(output)
```

### Retrieving Archived Webpages

You can retrieve a list of all archived webpages or get the latest archived webpage for a specific wallet address or the provided wallet itself.

To get all archived webpages, use the `getAllArchives` method. It returns a promise that resolves to an array of `Archive` objects, representing each archived webpage. Each object contains the ID, URL, title, webpage URL, screenshot URL, and timestamp.

```javascript
// Get all archives of the loaded Arweave wallet JWK
const allArchives = await archiver.getAllArchives();
console.log(allArchives)
// Get all archives of a wallet address
const allAddressArchives = await archiver.getAllArchives("some-wallet-address");
console.log(allAddressArchives)
```

### Get latest archived webpages

To get the latest archived webpage for a specific wallet address or the provided wallet itself, use the `getLatestArchive` method. It returns a promise that resolves to an `Archive` object representing the latest archived webpage, or null if no archived webpages are found.

```javascript
// Get latest archive of the loaded Arweave wallet JWK
const latestArchive = await archiver.getLatestArchive();
console.log(latestArchive)
// Get latest archive of a wallet address
const latestAddressArchive = await archiver.getLatestArchive("some-wallet-address");
console.log(latestAddressArchive)
```

## Related

- [save-html-screenshot](https://github.com/pawanpaudel93/save-html-screenshot)

## Author

👤 **Pawan Paudel**

- Github: [@pawanpaudel93](https://github.com/pawanpaudel93)

## 🤝 Contributing

Contributions, issues and feature requests are welcome! \ Feel free to check [issues page](https://github.com/pawanpaudel93/arweave-archive/issues).

## Show your support

Give a ⭐️ if this project helped you!

Copyright © 2023 [Pawan Paudel](https://github.com/pawanpaudel93)

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