- could you please explain code (fastseries,cb)
- how to use fastseries
- I dont understatnd cb ,
what is promisify
const { readFile } = require('fs')
const series = require('fastseries')()
const files = Array.from(Array(3)).fill(__filename)
const print = (err, data) => {
if (err) {
console.error(err)
return
}
console.log(Buffer.concat(data).toString())
}
const readers = files.map((file) => {
return (_, cb) => {
readFile(file, (err, contents) => {
if (err) cb(err)
else cb(null, contents)
})
}
})
series(null, readers, null, print)