npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

arweave-archive

v0.0.16

Published

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

Downloads

5

Readme

arweave-archive

arweave-archive is a node package that allows you to archive webpage and screenshot of the desired url on the Arweave blockchain. It provides a convenient way to store web content permanently and securely.

NPM version

Installation

Using npm,

npm install arweave-archive

Using yarn,

yarn add arweave-archive

Using pnpm,

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.

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:

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

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.

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.

// 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.

// 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

Author

👤 Pawan Paudel

🤝 Contributing

Contributions, issues and feature requests are welcome! \ Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

Copyright © 2023 Pawan Paudel