OverviewFilesCommitsIssuesDocsReleasesPeers

holepunchto-kb / skills / hyperswarm-testnet / api-extract.json

42 lines · json ref:
{
  "repo": "hyperswarm-testnet",
  "timestamp": "2026-01-16T23:56:10.266Z",
  "entryPoint": "index.js",
  "exports": {
    "packageJson": {
      "main": "index.js"
    }
  },
  "api": {
    "file": "index.js",
    "exports": [
      {
        "type": "default",
        "name": "require"
      }
    ],
    "classes": [],
    "functions": []
  },
  "readme": {
    "content": "# @hyperswarm/testnet\n\nSmall module to help you spin up a local Hyperswarm testnet.\n\n```\nnpm install @hyperswarm/testnet\n```\n\nUse this if you want to use the swarm in tests, etc.\n\n## Usage\n\n```js\nconst createTestnet = require('@hyperswarm/testnet')\n\nconst testnet = await createTestnet(10) // create a local testnet with 10 dht nodes\n```\n\n## API\n\n#### `const testnet = await createTestnet(size = 10, [options])`\n\nCreate a new testnet. `size` is how many DHT nodes you want in it. Options include:\n\n```js\n{\n  port: preferredLocalPort, // defaults to ANY (0)\n  host: preferredLocalHost, // defaults to 127.0.0.1\n  teardown // optional async teardown helper ie, t.teardown in brittle/tap etc\n}\n```\n\n#### `testnet.nodes`\n\nAn array of nodes in the testnet.\n\n#### `testnet.bootstrap`\n\nAn array of bootstrap addresses of the testnet.\n\n#### `const node = testnet.createNode([options])`\n\nCreate an additional ephemeral node and add it to the testnet. Options are the same as [`new DHT()`](https://github.com/h",
    "sections": [
      "intro",
      "usage",
      "api",
      "license"
    ],
    "hasApi": true,
    "hasExamples": true,
    "exampleCount": 3,
    "examples": [
      "npm install @hyperswarm/testnet",
      "const createTestnet = require('@hyperswarm/testnet')\n\nconst testnet = await createTestnet(10) // create a local testnet with 10 dht nodes",
      "{\n  port: preferredLocalPort, // defaults to ANY (0)\n  host: preferredLocalHost, // defaults to 127.0.0.1\n  teardown // optional async teardown helper ie, t.teardown in brittle/tap etc\n}"
    ]
  },
  "patterns": [
    "peer-discovery",
    "dht-discovery"
  ]
}