@web4/testnet

1.0.1 • Public • Published

@web4/testnet

Small module to help you spin up a local Bitswarm testnet.

npm install @web4/testnet

Use this if you want to use the swarm in tests, etc.

Usage

const createTestnet = require('@web4/testnet')

const nodes = await createTestnet(10) // create a local testnet with 10 dht nodes
const bootstrap = [{ host: '127.0.0.1', port: nodes[0].address().port }] // the bootstrap address for this testnet

API

const nodes = await createTestnet(size = 10, [options])

Create a new testnet. size is how many DHT nodes you want in it. Options include:

{
  port: preferredLocalPort, // defaults to ANY (0)
  host: preferredLocalHost, // defaults to 127.0.0.1
  teardown // optional async teardown helper ie, t.teardown in brittle/tap etc
}

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @web4/testnet

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

3.18 kB

Total Files

4

Last publish

Collaborators

  • neothawreww