{%= description %}
{%= include("install-npm", {save: true}) %}
var read = require('{%= name %}');
// async
read('foo.txt', function(err, buffer) {
//=> <Buffer 74 68 69 73 20 69 73 20 66 6f 6f>
});
// sync
var buffer = read.sync('foo.txt');
//=> <Buffer 74 68 69 73 20 69 73 20 66 6f 6f>
if utf8
encoding is used, byte order marks will be stripped
async
read('foo.txt', 'utf8', function(err, buffer) {
//=> 'some contents...'
});
// or
read('foo.txt', {encoding: 'utf8'} function(err, buffer) {
//=> 'some contents...'
});
sync
read.sync('foo.txt', 'utf8');
// or
read('foo.txt', {encoding: 'utf8'});
Pass { normalize: true }
on the options to strip windows carriage returns. This will also return a utf8
string.
{%= related(verb.related.list) %}
{%= include("tests") %}
{%= include("contributing") %}
{%= include("author") %}
{%= copyright() %} {%= license() %}
{%= include("footer") %}