JSPM

lnwatch

1.0.10
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q27592F
  • License MIT

Small utility for node, to watch symlink changes.

Package Exports

  • lnwatch

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lnwatch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lnwatch

Build Status

Small utility for node, to watch symlink changes.


Usage

var lnw = require('../lnwatch.js')

lnw.on('change', function (data) {
    console.log('LINK CHANGED', data);
})

lnw.add([
    './foo',
    './qux',  // nonexistent link, ignored
    './bar'
])

Methods

Add links to watch, can be a single link path string, or several in an array. Nonexistent links will be ignored.

Remove watched links, can be a single link path string, or several in an array. Nonexistent links will be ignored.

lnwatch.removeAll()

Remove all watched links.

Events

lnw.on('change', callback)

Fired when one of the watched link changes target. Receives data about what changed:

  • which link,
  • from what target,
  • to which target

Example:


lnw.on('change', function (data) {
    console.log(data);
})

/* 

outputs:

{ 
  link: '/Users/nec/github/lnwatch/tests/bar',
  from: '/Users/nec/github/lnwatch/tests/two',
  to: '/Users/nec/github/lnwatch/tests/three' 
}

*/