1.0.2 • Published 8 years ago

safe-readfile v1.0.2

Weekly downloads
626
License
Fair
Repository
github
Last release
8 years ago

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