const unzipFile = async function({ path }) { const zip = new AdmZip(path) const pExtractAll = promisify(zip.extractAllToAsync.bind(zip)) await pExtractAll(`${path}/..`, false) }
promisify(function invoke (opts, cb) { assert(typeof opts.procedure === 'string', 'Procedure must be a string') if (!this.isReady) { debug('client not ready yet, wait for connect') this.once('connect', () => { debug('invoke', opts) this._client.request(opts, cb) }) return } debug('invoke', opts) this._client.request(opts, cb) })
promisify(function fire (opts, cb) { assert(typeof opts.procedure === 'string', 'Procedure must be a string') cb = cb || noop if (!this.isReady) { debug('client not ready yet, wait for connect') this.once('connect', () => { debug('fire', opts) this._client.fire(opts, cb) }) return } debug('fire', opts) this._client.fire(opts, cb) })