ewajs
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

ewajs

NPM version

ewajs means 二娃 in Chinese, who is one young hero with great eyesight(qianli yan) and hearing(shunfeng er).

Get Started

Install by

npm i -S ewajs

Javascript Apis

Watch

You can watch change of fs target position(whether its existence when you start watching) with those signals:

  • EV_FILE_ADDED: watched file added, it didn't exist before.
  • EV_FILE_MODIFIED: watched file modifed, it existed before.
  • EV_FILE_REMOVED: watched file removed, it existed before.
  • EV_DIR_ADDED: watched directory removed, it existed before.
  • EV_DIR_REMOVED: watched directory removed, it existed before.
  • EV_SYMLINK_ADDED: watched symbolic link removed, it didn't exist before.
  • EV_SYMLINK_REMOVED: watched symbolic link removed, it existed before.
import { watch, SIGNALS } from 'ewajs'

// start watching one file, detecting its change(added, removed, modefied)
const qianliyan = watch('/path/to/file')

// subscribe when it's added
qianliyan.on(SIGNALS.EV_FILE_ADDED, () => {
    // deal
})

// stop watch
qianliyan.stop()

you can also watch one directory

// start watching one file, detecting its change(added, removed, modefied)
const qianliyan = watch('/path/to/dir')

qianliyan.on(SIGNALS.EV_DIR_ADDED, () => {
    // deal
})

/ewajs/

    Package Sidebar

    Install

    npm i ewajs

    Weekly Downloads

    0

    Version

    0.1.3

    License

    ISC

    Unpacked Size

    14.2 kB

    Total Files

    10

    Last publish

    Collaborators

    • richardo2016