Read many files with node
JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.eslintrc
.gitignore
ChangeLog
LICENSE
README.md
package.json

README.md

Files-io

Read many files with node

Install

npm i files-io --save

How to use?

const files = require('files-io');

files.read(['README.md', 'package.json'], 'utf8', (error, allData) => {
    console.log(error, allData);
});


/* Easy way to create pipe which would handle all error events and redirect tham to callback. */
const NameFrom = 'README.md';
const NameTo = 'README_COPY.gz';
    
const options = {
    gzip: true
};

files.pipe(NameFrom, NameTo, options, (error) => {
    console.log(error || 'done');
});

/* join couple files and save them to new file with streams */
const fs = require('fs');
const NAME = 'Join';
const writeStream = fs.createWriteStream(NAME);

files.readPipe(['README.md', 'package.json'], writeStream, (error) => {
    if (error)
        console.log(error.message);
});

License

MIT