Last active
December 23, 2018 17:41
-
-
Save simonespa/6bcfc63bb4e6c7fc66b95baccac74f40 to your computer and use it in GitHub Desktop.
File watcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env node | |
| const fs = require('fs'); | |
| const file = '/path/to/file.json'; | |
| fs.watch(file, (eventType, filename) => { | |
| fs.readFile(file, 'utf8', function (err, data) { | |
| if (err) throw err; | |
| process.env.DATA = data; | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment