@arweave-cdn/uploader
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Arweave uploader

Build Status Coverage Status

Tiny SDK to upload assets to Arweave permaweb, it's a core uploader used in the following plugins:

Installation

Using npm:

npm install @arweave-cdn/uploader --save 

Usage

import { ArweaveUploader } from '@arweave-cdn/uploader';

const arweaveUploader = new ArweaveUploader();
await arweaveUploader.init('/absolute/path/to/arweave-wallet-key-file.json');

const filesToUpload = [
  '/Users/andrew/web3/index.html',
  '/Users/andrew/web3/styles.css',
  '/Users/andrew/web3/images/unicorn_llama.jpg',
];
await arweaveUploader.uploadAssets(filesToUpload, '/Users/andrew/web3/', 'index.html');

Methods


init(walletKeyFilepath, arweaveApiConfig)
  • walletKeyFilePath (required): Absolute file path to arweave wallet key file
  • arweaveApiConfig (optional): Arweave API config object to use for Arweave connection. Defaults to following values:
{
    host: 'arweave.net',// Hostname or IP address for a Arweave host
    port: 443,          // Port
    protocol: 'https',  // Network protocol http or https
    timeout: 20000,     // Network request timeouts in milliseconds
    logging: false,     // Enable network request logging
}

uploadAssets(filesToUpload, rootPath, indexFile, verbose)
  • filesToUpload (required): Array of files (with absolute file paths) which need to be uploaded
  • rootPath (required): Path to the directory which is being uploaded
  • indexFile (optional): Index file (relative path), e.g. index.html
  • verbose (optional): Boolean field to enable / disable progress messages, defaults to true

Readme

Keywords

none

Package Sidebar

Install

npm i @arweave-cdn/uploader

Weekly Downloads

12

Version

1.0.4

License

MIT

Unpacked Size

73.1 kB

Total Files

15

Last publish

Collaborators

  • bonifaty