Coder Social home page Coder Social logo

tamzinselvi / chokidar-socket-emitter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from capaj/chokidar-socket-emitter

0.0 1.0 0.0 32 KB

a simple chokidar watcher which emits events to all connected socket.io clients

License: MIT License

JavaScript 100.00%

chokidar-socket-emitter's Introduction

chokidar-socket-emitter

a simple chokidar watcher and socket.io server which emits file system events to all connected socket.io clients. Primarily it should serve as an event source for systemjs-hot-reloader but you can use it any other way.

Install

npm i -D chokidar-socket-emitter

CLI usage

npm i -g chokidar-socket-emitter
chokidar-socket-emitter -l 1234

By default listens on port 5776.

NPM script usage

Combined with browser-sync:

"scripts": {
  "start": "npm run serve & npm run watch",
  "serve": "browser-sync start --server",
  "watch": "chokidar-socket-emitter"
},

Start by running:

npm start

Programatic usage

var chokidarEvEmitter = require('chokidar-socket-emitter')
chokidarEvEmitter({port: 8090}) //path is taken from jspm/directories/baseURL or if that is not set up, '.' is used
//or specify the path
chokidarEvEmitter({port: 8090, path: '.'})

//you can also supply an http server instance, that way it will run within your server, no need for extra port
require('chokidar-socket-emitter')({app: server})

FAQ

Does chokidar have problems with watching drives mounted from VMs hosts/network?

Yes and if you want it to work, use additional opts property to switch to polling mode

chokidarEvEmitter({port: 8090, path: '.', chokidar: {usePolling: true}})

chokidar-socket-emitter's People

Contributors

alteredconstants avatar capaj avatar guybedford avatar johnraz avatar kwesterfeld2 avatar peteruithoven avatar tamzinselvi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.