readfile-cache-pmb
Cache buffers from fs.readFile, deliver as needed, handy additional encodings.
- If an encoding is requested. convert and deliver as string.
- Supported encodings include
utf-8-no-bom
,utf8noBOM
,JSON
,json
,buffer
, and the defaults. - If encoding is
undefined
or omitted, it defaults to UTF-8. Givenull
orbuffer
if you want a buffer.
- Supported encodings include
- Magic filenames (prepend
./
to avoid):-
= stdin
- Want to read from something other than your file system?
Just set
cache.fsReadFileFunc
to your reader function.
Usage
from test.js:
var test = ReadFileCache = cache = ; test; test;
License
ISC