OverviewFilesCommitsIssuesDocsReleasesPeers

holepunchto-kb / skills / hypercore / api-extract.json

87 lines · json ref:
{
  "repo": "hypercore",
  "timestamp": "2026-01-16T23:00:26.643Z",
  "entryPoint": "index.js",
  "exports": {
    "packageJson": {
      "main": "index.js"
    }
  },
  "api": {
    "file": "index.js",
    "exports": [
      {
        "type": "default",
        "name": "Hypercore"
      }
    ],
    "classes": [
      {
        "name": "Hypercore"
      }
    ],
    "functions": [
      {
        "name": "isStream"
      },
      {
        "name": "preappend"
      },
      {
        "name": "isValidIndex"
      },
      {
        "name": "maybeUnslab"
      },
      {
        "name": "checkSnapshot"
      },
      {
        "name": "readBlock"
      },
      {
        "name": "initOnce"
      },
      {
        "name": "maybeAddMonitor"
      },
      {
        "name": "isSessionMoved"
      },
      {
        "name": "getEncryptionOption"
      },
      {
        "name": "isEncryptionProvider"
      },
      {
        "name": "isFunction"
      }
    ]
  },
  "readme": {
    "content": "# Hypercore\n\n### [See the full API docs at docs.pears.com](https://docs.pears.com/building-blocks/hypercore)\n\nHypercore is a secure, distributed append-only log.\n\nBuilt for sharing large datasets and streams of real time data\n\n## Features\n\n- **Sparse replication.** Only download the data you are interested in.\n- **Realtime.** Get the latest updates to the log fast and securely.\n- **Performant.** Uses a simple flat file structure to maximize I/O performance.\n- **Secure.** Uses signed merkle trees to verify log integrity in real time.\n- **Modular.** Hypercore aims to do one thing and one thing well - distributing a stream of data.\n\nNote that the latest release is Hypercore 10, which adds support for truncate and many other things.\nVersion 10 is not compatible with earlier versions (9 and earlier), but is considered LTS, meaning the storage format and wire protocol is forward compatible with future versions.\n\n## Install\n\n```sh\nnpm install hypercore\n```\n\n## API\n\n#### `const core = new Hype",
    "sections": [
      "intro",
      "features",
      "install",
      "api"
    ],
    "hasApi": true,
    "hasExamples": true,
    "exampleCount": 36,
    "examples": [
      "## API\n\n#### `const core = new Hypercore(storage, [key], [options])`\n\nMake a new Hypercore instance.\n\n`storage` should be set to a directory where you want to store the data and core metadata.",
      "Alternatively you can pass a [Hypercore Storage](https://github.com/holepunchto/hypercore-storage) or use a [Corestore](https://github.com/holepunchto/corestore) if you want to make many Hypercores efficiently. Note that `random-access-storage` is no longer supported.\n\n`key` can be set to a Hypercore key which is a hash of Hypercore's internal auth manifest, describing how to validate the Hypercore. If you do not set this, it will be loaded from storage. If nothing is previously stored, a new auth manifest will be generated giving you local write access to it.\n\n`options` include:",
      "You can also set `valueEncoding` to any [compact-encoding](https://github.com/holepunchto/compact-encoding) instance.\n\n`valueEncoding`s will be applied to individual blocks, even if you append batches. If you want to control encoding at the batch-level, you can use the `encodeBatch` option, which is a function that takes a batch and returns a binary-encoded batch. If you provide a custom `valueEncoding`, it will not be applied prior to `encodeBatch`.\n\nThe user may provide a custom encryption module as `opts.encryption`, which should satisfy the [HypercoreEncryption](https://github.com/holepunchto/hypercore-encryption) interface.\n\n##### User Data\n\nUser Data is a key-value store that is persisted locally and is not replicated with the Hypercore. This is useful as a quick store for data only used by the current peer. For example, `autobase` uses User Data to store information such as encryption keys and connections between a peer's local writer and the Autobase's bootstrap core.\n\nKeys are always strings and values can be strings or buffers.\n\nSee [`core.setUserData(key, value)`](#await-coresetuserdatakey-value) and [`core.getUserData(key)`](#const-value--await-coregetuserdatakey) for updating User Data.\n\n##### Manifest\n\nThe manifest is metadata about authenticating a hypercore including things like the signers (only one by default) and the prologue. Manifest has the following structure:"
    ]
  },
  "patterns": [
    "append-only-log",
    "stream-multiplexing",
    "replication",
    "binary-encoding",
    "cryptography",
    "streaming"
  ]
}