Set the execution context (this) for workers
masterWhen creating a queue, you can optionally provide a that argument as the first parameter to fastq() or fastq.promise(). This object will be used as the this context inside your worker function.
'use strict'
const that = { hello: 'world' }
const queue = require('fastq')(that, worker, 1)
queue.push(42, function (err, result) {
if (err) { throw err }
console.log(this) // Accesses { hello: 'world' }
console.log('the result is', result)
})
function worker (arg, cb) {
console.log(this) // Accesses { hello: 'world' }
cb(null, arg * 2)
}