Socket
Socket
Sign inDemoInstall

is-empty-file

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-empty-file

Checks if a file is empty or not. Handling trailing whitespace is configurable.


Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Install size
2.97 kB
Created
Weekly downloads
 

Readme

Source

is-empty-file Build Status

Node module to check if a file is empty, optionally ignoring trailing whitespace.

Usage

$ npm install --save is-empty-file
var isEmpty = require('is-empty-file');

isEmpty('anEmptyFile.txt', function (result) {
	console.log(result); // true
});

// Sync behaviour
console.log(isEmpty('anEmptyFile.txt')); // true

The 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
});

Keywords

FAQs

Last updated on 16 Feb 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc