OverviewFilesCommitsIssuesDocsReleasesPeers

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

61 lines · json ref:
{
  "repo": "localwatch",
  "timestamp": "2026-01-16T23:55:45.870Z",
  "entryPoint": "index.js",
  "exports": {
    "packageJson": {
      "main": "index.js"
    }
  },
  "api": {
    "file": "index.js",
    "exports": [
      {
        "type": "default",
        "name": "class"
      }
    ],
    "classes": [
      {
        "name": "TreeEntry"
      },
      {
        "name": "Localwatch"
      }
    ],
    "functions": [
      {
        "name": "readdir"
      },
      {
        "name": "lstat"
      },
      {
        "name": "isRooted"
      },
      {
        "name": "defaultFilter"
      }
    ]
  },
  "readme": {
    "content": "# localwatch\n\nWatch a directory and get a diff of changes\n\n```\nnpm install localwatch\n```\n\n## Usage\n\n```js\nconst Localwatch = require('localwatch')\n\n// watch a dir\nconst watch = new Localwatch('./my/dir')\n\n// watch is a readable stream\n\nfor await (const diff of watch) {\n  // diff is the next batch of changes\n  // [{ type: update|delete, filename }, ...]\n}\n```\n\n## API\n\n#### `stream = new Localwatch(dir, [options])`\n\nMake a watch stream.\n\nOptions include\n\n```js\n{\n  // function that returns true if it should watch it\n  // defaults to ignoring .git and corestores\n  filter (filename, stream) { ... },\n  // optionally map the diff entries\n  map (entry) { return ... },\n  // use relative paths in the diff\n  relative: false,\n  // include hidden files (.something)\n  hidden: false,\n  // wait for the watched folder to be idle for 100ms\n  // before triggering the batch after a change has happened.\n  // disable this if you the watcher to be fully interactive\n  settle: true\n}\n```\n\nThe stream yields di",
    "sections": [
      "intro",
      "usage",
      "api",
      "license"
    ],
    "hasApi": true,
    "hasExamples": true,
    "exampleCount": 4,
    "examples": [
      "npm install localwatch",
      "const Localwatch = require('localwatch')\n\n// watch a dir\nconst watch = new Localwatch('./my/dir')\n\n// watch is a readable stream\n\nfor await (const diff of watch) {\n  // diff is the next batch of changes\n  // [{ type: update|delete, filename }, ...]\n}",
      "{\n  // function that returns true if it should watch it\n  // defaults to ignoring .git and corestores\n  filter (filename, stream) { ... },\n  // optionally map the diff entries\n  map (entry) { return ... },\n  // use relative paths in the diff\n  relative: false,\n  // include hidden files (.something)\n  hidden: false,\n  // wait for the watched folder to be idle for 100ms\n  // before triggering the batch after a change has happened.\n  // disable this if you the watcher to be fully interactive\n  settle: true\n}"
    ]
  },
  "patterns": [
    "streaming"
  ]
}