All Projects → bevry → Watchr

bevry / Watchr

Licence: other
Better file system watching for Node.js. Provides a normalised API the file watching APIs of different node versions, nested/recursive file and directory watching, and accurate detailed events for file/directory changes, deletions and creations.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Watchr

mem64
Run Any Native PE file as a memory ONLY Payload , most likely as a shellcode using hta attack vector which interacts with Powershell.
Stars: ✭ 26 (-95.05%)
Mutual labels:  executable
HatVenom
HatVenom is a HatSploit native powerful payload generation tool that provides support for all common platforms and architectures.
Stars: ✭ 84 (-84%)
Mutual labels:  executable
Getmac
Get the mac address of the current machine you are on via Node.js
Stars: ✭ 261 (-50.29%)
Mutual labels:  executable
parcl
Gradle plugin for bundling your Java application for distribution on Windows, Mac and Linux
Stars: ✭ 52 (-90.1%)
Mutual labels:  executable
basgo
basgo compiles BASIC-lang to Golang. Then 'go build' can translate code to native executable binary.
Stars: ✭ 31 (-94.1%)
Mutual labels:  executable
dogfood
A tool for building self contained Lua executables
Stars: ✭ 26 (-95.05%)
Mutual labels:  executable
wasm-joey
Serverless Wasm - A lightweight Node.js application for deploying and executing WebAssembly(Wasm) binary-code via HTTP
Stars: ✭ 48 (-90.86%)
Mutual labels:  executable
Composer Bin Plugin
No conflicts for your bin dependencies
Stars: ✭ 287 (-45.33%)
Mutual labels:  executable
make-deno-edition
Automatically makes package.json projects (such as npm packages and node.js modules) compatible with Deno.
Stars: ✭ 39 (-92.57%)
Mutual labels:  executable
executive
🕴Elegant command execution for Node.
Stars: ✭ 37 (-92.95%)
Mutual labels:  executable
ELFDump
ELFDump is a C parser for ELF64 object files.
Stars: ✭ 15 (-97.14%)
Mutual labels:  executable
FullProxy
Bind and reverse connection based, SOCKS5, HTTP and PortForward based portable proxy
Stars: ✭ 22 (-95.81%)
Mutual labels:  executable
envfile
Parse and write environment files with Node.js
Stars: ✭ 42 (-92%)
Mutual labels:  executable
get-bin-path
Get the current package's binary path
Stars: ✭ 25 (-95.24%)
Mutual labels:  executable
Picocli
Picocli is a modern framework for building powerful, user-friendly, GraalVM-enabled command line apps with ease. It supports colors, autocompletion, subcommands, and more. In 1 source file so apps can include as source & avoid adding a dependency. Written in Java, usable from Groovy, Kotlin, Scala, etc.
Stars: ✭ 3,286 (+525.9%)
Mutual labels:  executable
pe-loader
A Windows PE format file loader
Stars: ✭ 81 (-84.57%)
Mutual labels:  executable
you-get.exe
You-Get unofficial build executable for Windows || You-Get 非官方构建的可执行文件
Stars: ✭ 40 (-92.38%)
Mutual labels:  executable
Nar
node.js application archive - create self-contained binary like executable applications that are ready to ship and run
Stars: ✭ 428 (-18.48%)
Mutual labels:  executable
Sourcedocs
Generate Markdown documentation from source code
Stars: ✭ 286 (-45.52%)
Mutual labels:  executable
ExecutionMaster
Windows utility for intercepting process creation and assigning standard actions to program startup
Stars: ✭ 54 (-89.71%)
Mutual labels:  executable

watchr

Travis CI Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
GitHub Sponsors donate button Patreon donate button Flattr donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

Watchr provides a normalised API the file watching APIs of different node versions, nested/recursive file and directory watching, and accurate detailed events for file/directory creations, updates, and deletions.

Usage

Complete API Documentation.

There are two concepts in watchr, they are:

  • Watcher - this wraps the native file system watching, makes it reliable, and supports deep watching
  • Stalker - this wraps the watcher, such that for any given path, there can be many stalkers, but only one watcher

The simplest usage is:

// Import the watching library
var watchr = require('watchr')

// Define our watching parameters
var path = process.cwd()
function listener(changeType, fullPath, currentStat, previousStat) {
    switch (changeType) {
        case 'update':
            console.log(
                'the file',
                fullPath,
                'was updated',
                currentStat,
                previousStat
            )
            break
        case 'create':
            console.log('the file', fullPath, 'was created', currentStat)
            break
        case 'delete':
            console.log('the file', fullPath, 'was deleted', previousStat)
            break
    }
}
function next(err) {
    if (err) return console.log('watch failed on', path, 'with error', err)
    console.log('watch successful on', path)
}

// Watch the path with the change listener and completion callback
var stalker = watchr.open(path, listener, next)

// Close the stalker of the watcher
stalker.close()

More advanced usage is:

// Create the stalker for the path
var stalker = watchr.create(path)

// Listen to the events for the stalker/watcher
stalker.on('change', listener)
stalker.on('log', console.log)
stalker.once('close', function (reason) {
    console.log('closed', path, 'because', reason)
    stalker.removeAllListeners() // as it is closed, no need for our change or log listeners any more
})

// Set the default configuration for the stalker/watcher
stalker.setConfig({
    stat: null,
    interval: 5007,
    persistent: true,
    catchupDelay: 2000,
    preferredMethods: ['watch', 'watchFile'],
    followLinks: true,
    ignorePaths: false,
    ignoreHiddenFiles: false,
    ignoreCommonPatterns: true,
    ignoreCustomPatterns: null,
})

// Start watching
stalker.watch(next)

// Stop watching
stalker.close()

Install

npm

  • Install: npm install --save watchr
  • Import: import * as pkg from ('watchr')
  • Require: const pkg = require('watchr')

Editions

This package is published with the following editions:

  • watchr aliases watchr/source/index.js
  • watchr/source/index.js is ESNext source code for Node.js 10 || 12 || 14 || 15 with Require for modules

TypeScript

This project provides its type information via inline JSDoc Comments. To make use of this in TypeScript, set your maxNodeModuleJsDepth compiler option to 5 or thereabouts. You can accomlish this via your tsconfig.json file like so:

{
  "compilerOptions": {
    "maxNodeModuleJsDepth": 5
  }
}

History

Discover the release history by heading on over to the HISTORY.md file.

Contribute

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first?

GitHub Sponsors donate button Patreon donate button Flattr donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

Contributors

These amazing people have contributed code to this project:

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

License

Unless stated otherwise all works are:

and licensed under:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].