OverviewFilesCommitsIssuesDocsReleasesPeers

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

94 lines · json ref:
{
  "repo": "hyperdrive",
  "timestamp": "2026-01-16T23:00:27.444Z",
  "entryPoint": "index.js",
  "exports": {
    "packageJson": {
      "main": "index.js"
    }
  },
  "api": {
    "file": "index.js",
    "exports": [
      {
        "type": "default",
        "name": "class"
      }
    ],
    "classes": [
      {
        "name": "Hyperdrive"
      }
    ],
    "functions": [
      {
        "name": "onblobs"
      },
      {
        "name": "onnode"
      },
      {
        "name": "onblobs"
      },
      {
        "name": "callOnfinish"
      },
      {
        "name": "callOndrain"
      },
      {
        "name": "shallowReadStream"
      },
      {
        "name": "makeBee"
      },
      {
        "name": "getBee"
      },
      {
        "name": "std"
      },
      {
        "name": "validateFilename"
      },
      {
        "name": "prefixRange"
      },
      {
        "name": "generateContentManifest"
      },
      {
        "name": "getBlobsLength"
      },
      {
        "name": "toIgnoreFunction"
      },
      {
        "name": "createStreamMapIgnore"
      }
    ]
  },
  "readme": {
    "content": "# Hyperdrive\n\n[See API docs at docs.pears.com](https://docs.pears.com/building-blocks/hyperdrive)\n\nHyperdrive is a secure, real-time distributed file system\n\n## Install\n\n```sh\nnpm install hyperdrive\n```\n\n## Usage\n\n```js\nconst Hyperdrive = require('hyperdrive')\nconst Corestore = require('corestore')\n\nconst store = new Corestore('./storage')\nconst drive = new Hyperdrive(store)\n\nawait drive.put('/blob.txt', Buffer.from('example'))\nawait drive.put('/images/logo.png', Buffer.from('..'))\nawait drive.put('/images/old-logo.png', Buffer.from('..'))\n\nconst buffer = await drive.get('/blob.txt')\nconsole.log(buffer) // => <Buffer ..> \"example\"\n\nconst entry = await drive.entry('/blob.txt')\nconsole.log(entry) // => { seq, key, value: { executable, linkname, blob, metadata } }\n\nawait drive.del('/images/old-logo.png')\n\nawait drive.symlink('/images/logo.shortcut', '/images/logo.png')\n\nfor await (const file of drive.list('/images')) {\n  console.log('list', file) // => { key, value }\n}\n\nconst rs = drive.c",
    "sections": [
      "intro",
      "install",
      "usage",
      "api",
      "license"
    ],
    "hasApi": true,
    "hasExamples": true,
    "exampleCount": 21,
    "examples": [
      "## Usage",
      "## API\n\n#### `const drive = new Hyperdrive(store, [key])`\n\nCreates a new Hyperdrive instance. `store` must be an instance of `Corestore`.\n\nBy default it uses the core at `{ name: 'db' }` from `store`, unless you set the public `key`.\n\n#### `await drive.ready()`\n\nWaits until internal state is loaded.\n\nUse it once before reading synchronous properties like `drive.discoveryKey`, unless you called any of the other APIs.\n\n#### `await drive.close()`\n\nFully close this drive, including its underlying Hypercore backed datastructures.\n\n#### `drive.corestore`\n\nThe Corestore instance used as storage.\n\n#### `drive.db`\n\nThe underlying Hyperbee backing the drive file structure.\n\n#### `drive.core`\n\nThe Hypercore used for `drive.db`.\n\n#### `drive.id`\n\nString containing the id (z-base-32 of the public key) identifying this drive.\n\n#### `drive.key`\n\nThe public key of the Hypercore backing the drive.\n\n#### `drive.discoveryKey`\n\nThe hash of the public key of the Hypercore backing the drive.\n\nCan be used as a `topic` to seed the drive using Hyperswarm.\n\n#### `drive.contentKey`\n\nThe public key of the [Hyperblobs](https://github.com/holepunchto/hyperblobs) instance holding blobs associated with entries in the drive.\n\n#### `drive.writable`\n\nBoolean indicating if we can write or delete data in this drive.\n\n#### `drive.readable`\n\nBoolean indicating if we can read from this drive. After closing the drive this will be `false`.\n\n#### `drive.version`\n\nNumber that indicates how many modifications were made, useful as a version identifier.\n\n#### `drive.supportsMetadata`\n\nBoolean indicating if the drive handles or not metadata. Always `true`.\n\n#### `await drive.put(path, buffer, [options])`\n\nCreates a file at `path` in the drive. `options` are the same as in `createWriteStream`.\n\n#### `const buffer = await drive.get(path, [options])`\n\nReturns the blob at `path` in the drive. If no blob exists, returns `null`.\n\nIt also returns `null` for symbolic links.\n\n`options` include:",
      "#### `const entry = await drive.entry(path, [options])`\n\nReturns the entry at `path` in the drive. It looks like this:"
    ]
  },
  "patterns": [
    "append-only-log",
    "binary-encoding",
    "streaming"
  ]
}