0.1.8 β€’ Published 3 years ago

scanwatch v0.1.8

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

πŸ‡ΊπŸ‡¦ scanwatch 0.1.8

Scan files and watch for changes

Fast and simple file watcher for Node without all the fanciful decoration

Features

Scanwatch has following features

  • extremely fast and simple (242 lines of code and 4 deps only)
  • follow symlinks
  • ignore subpaths with minimalist and regex
  • events callback file scan, skip, changed, deleted

Version history

scanwatch version 0.1.8 (see version history below for details)

πŸ„β€β™‚οΈ Quick start

Pre-requirements

  • NodeJS 16.x (Lastest). Scanwatch works with older version also like 8.x

Install

Using npm:

npm i scanwatch

Using yarn:

yarn install scanwatch

Using pnpm:

pnpm i scanwatch

Run

Create options {...} object with paths and scanwatch options then run scanwatch.setup(options, callback)

Usage example:

  var scanwatch = require('scanwatch')

  var options = {
    debug: 1,
    common: {
      ignore: [
        '.git',
        '.git/**',
        /^test\/.*/,
        'node_modules',
        'node_modules/**',
        'node_modules/**/.*',
        'node_modules/**/.*/**'
      ]
    },
    paths: {}
  }
  options.paths[__dirname] = {
    ignore: [
      /^\.idea.*/
    ]
  }
  options.paths[__dirname+'/node_modules'] = {}

  scanwatch.setup(options, function fileChanged(type, path) {
    if (type == 'skip') {
      console.log('[skipping]', path)
      return
    }
    console.log(type, path)
  })

πŸ“š Documentation

Scanwatch use simple API for your files

scanwatch.setup(options, callback)

Scanwatch your paths

scanwatch.setup(options, function fileChanged(type, path) {
  ...
})

options configuration

debug: 0|1 console log debug information

common = {} common options

common.ignore = [] ignore patterns array with regex or minimist format

paths = {} paths object. each path is key like options.paths[__dirname+'/node_modules'] = {}

callback events

scan - initial scan

skip - file skipped

changed - file changed

deleted - file deleted

Code and architecture

Scanwatch use self-documenting code and architecture with livecomment

Install livecomment

npm -g i livecomment

Run live docs

livecomment --path node_modules/scanwatch

open http://localhost:3070/

and see code docs like this

πŸ’³ Support

Please become Github Sponsor or donate for support scanwatch and other projects development

Donate with crypto:

  • BTC: bc1q5ad4pzxxqmc6rehy2y2fn58utm5jkhwphznruj
  • ETH:
  • Polkadot:
  • Casper:
  • Paypal

License

MIT

Contributing

Standard contributing rules for professional developer, pull requests, etc.

βœ… Version history

Changelog

  • 0.1.8 bugfix: fix symlink dir bug. update readme show
  • 0.1.7 bugfix: scan files crash Changelog
  • 0.1.6 bugfix: watch/delete for new/deleted files/dirs
0.1.8

3 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago