Skip to content

Asynchronous multiple file read with promises! 🚀

License

Notifications You must be signed in to change notification settings

tHBp/batch-read

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

batch-read

Asynchronous multiple file read with promises! 🚀

Getting Started

$ npm install --save batch-read

Usage

const batchRead = require('batch-read');

batchRead(['file-1', 'file-2', 'file-3', 'file-n']).then(function(result){
    console.log(result);
    /* [
        {
            file: 'file-1',
            data: 'This is file 1'
        },
        {
            file: 'file-2',
            data: 'This is file 2'
        },
        {
            file: 'file-3',
            data: 'This is file 3'
        },
        {
            file: 'file-n',
            data: 'This is file n'
        }
    ]*/
}).catch(function(error){
    //catch the error!
})

API

batchRead(array [, encoding])

Reads the array of files and returns a promise that resolves when everything completes.

array

Type: Array
Default: none

Array of files to be read.

encoding

Type: String
Default: utf-8

The encoding of the files to be read.

License

MIT © The Half Blood Prince

About

Asynchronous multiple file read with promises! 🚀

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published