is-empty-file
v1.0.1
Published
Checks if a file is empty or not. Handling trailing whitespace is configurable.
Maintainers
Readme
is-empty-file 
Node module to check if a file is empty, optionally ignoring trailing whitespace.
Usage
$ npm install --save is-empty-filevar isEmpty = require('is-empty-file');
isEmpty('anEmptyFile.txt', function (result) {
console.log(result); // true
});
// Sync behaviour
console.log(isEmpty('anEmptyFile.txt')); // trueThe first argument you pass is the file name. The last one is the callback. If no callback is provided, the function will behave synchronously.
There's also an option (defaulting to false) to ignore trailing whitespace.
var isEmpty = require('is-empty-file');
isEmpty('bunchaWhitespace.txt', true, function (r) {
console.log(r); // true
});