Socket
Socket
Sign inDemoInstall

cousin-harris

Package Overview
Dependencies
2
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cousin-harris

a wrapper around fb-watchman with a nicer interface


Version published
Maintainers
1
Created

Readme

Source

cousin-harris

build status Known Vulnerabilities Renovate

Usage

import cousinHarris from 'cousin-harris'
import delay from 'delay'

const roots = ['dir1', 'dir2']
const watcher = cousinHarris(
  roots,
  ({ root, path, removal, isDirectory }) => {
    console.log(
      '%s %s at root %s was %s',
      isDirectory ? 'directory' : 'file',
      path,
      root,
      removal ? 'removed' : 'changed',
    )
  },
  { watchProject: true },
)

// wait for all watches to be initialised
await watcher.waitForWatches

// add more watches after a second
await delay(1000)
await watcher.addRoot('dir3')
await watcher.waitForWatches

// stop watching one second after setting up watch for 'dir3'
await delay(1000)
await watcher.stop()

Without { watchProject: true } watchman's watch command is used instead of watch-project.

The root passed to the update function will be an absolute path, if it's important to receive the same root as was passed then the result of fs.realPath or equivalent should be passed to cousinHarris.

Keywords

FAQs

Last updated on 08 Nov 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc