|
5 月之前 | |
---|---|---|
.. | ||
README.md | 5 月之前 | |
filemap.js | 5 月之前 | |
package.json | 5 月之前 |
Quickly load a collection of filepaths.
Produces an object where the filepaths are the keys and the content is the value.
npm install filemap
filemap(filepaths, [encoding], callback);
Load an array of files as raw buffers:
var filemap = require('filemap');
filemap(['foo/fuu.txt', 'omg.lol'], function (files) {
console.log(files);
});
Would output something like:
{ 'foo/fuu.txt': < 08 23 23 23 42 >,
'omg.lol': < 34 24 25 64 45 >
}
Load an object of files with utf-8 encoding:
var filemap = require('filemap');
filemap({'foo/fuu.txt': false, 'lol.bbq': false}, 'utf-8', function (files) {
console.log(files);
});
Would output something like:
{ 'foo/fuu.txt': 'you sir, are awesome!',
'omg.lol': false // If this file didn't exist
}
ISC