safe-readfile

1.0.2 • Public • Published

safe-readfile

A version of fs.readFile and fs.readFileSync that doesn't raise ENOENT.
Returns undefined if the file doesn't exist and '' if the file exists and it's empty.

Usage

$ npm install safe-readfile
(...)
$ node
> var safeReadFile = require('safe-readfile').readFile
undefined
> safeReadFile('nonexistent') // fs.readFile would throw ENOENT
undefined

Readme

Keywords

Package Sidebar

Install

npm i safe-readfile

Weekly Downloads

256

Version

1.0.2

License

Fair

Last publish

Collaborators

  • talles