Skip to content
/ rewind Public

Automatically reload a node application when files change.

Notifications You must be signed in to change notification settings

weaver/rewind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rewind

Automatically restart a Node application when dependencies change.

Installation

Install with npm:

npm install -g rewind

Getting Started

Start your application with rewind instead of node:

rewind server.js 3000

This will load server.js as the main module. Any changes to server.js or its dependencies will cause the server to restart.

If your application caches non-module assets, use the -w option to watch them. For example:

rewind -w ./static -w ./templates server.js 3000

Rewind will scan these files or folders recursively. If any file is modified, the application with be restarted.

Features

  • Restarts your application automatically when files change.
  • Monitors anything Node loads; no hard-coded filename extensions!
  • By default, only monitor loaded modules; no need for .ignore files.
  • Uses fs.watch(), so detecting changes is fast!
  • Optionally upports monitoring any additional folders.
  • Ignores temporary editor files.

How it Works

Rewind forks a subprocess to run the real application. The subprocess detects loaded modules and reports them to the parent, which is monitoring the filesystem using fs.watch(). If any dependency changes, the subprocess is terminated with a SIGHUP and forked again.

If the subprocess dies (exits non-zero), rewind waits until one on the monitored files is changed. If the subprocess terminatss normally (exits zero), rewind stops monitoring files and exits as well.

About

Automatically reload a node application when files change.

Resources

Stars

Watchers

Forks

Packages

No packages published