Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(function (resolve, reject) {
var wStream = isWritable(destination) ? destination : fs.createWriteStream(destination)
eos(wStream, function (err) {
if (err) return reject(new Error('stream had an error or closed early'))
resolve(this)
})
/* start decrypt */
self.inputStream.pipe(base64.decode())
.pipe(self.sDecrypt)
.pipe(wStream)
})
}
async dispose () {
if (this.disposed)
return Promise.resolve();
this.disposed = true;
if (!this.outStream || Reporter._isSpecialStream(this.outStream) || !isWritableStream(this.outStream))
return Promise.resolve();
const streamFinishedPromise = new Promise(resolve => {
this.outStream.once('finish', resolve);
this.outStream.once('error', resolve);
});
this.outStream.end();
return streamFinishedPromise;
}
}
function validateReporterOutput (obj) {
const isValidReporterOutput = obj === void 0 ||
typeof obj === 'string' ||
isWritableStream(obj) ||
isStreamMock(obj);
if (!isValidReporterOutput)
throw new GeneralError(RUNTIME_ERRORS.invalidReporterOutput);
}
var stream = mold.transform(function(src, write) {
if (!src.sourcemap) {
if (errorOnMissing) return stream.emit('error', new Error(missingMapMsg));
stream.emit(
'missing-map'
, missingMapMsg + '\n'
+ 'Therefore it was piped through as is and no external map file generated.'
);
return write(src.source);
}
if (isStream(input) && isStream.writable(stream)) {
return stream.emit('error', new Error('Must provide a writable stream'));
}
if (isStream(input) && typeof url !== 'string') {
return stream.emit('error', new Error('map file URL is required when using stream output'));
}
url = url || path.basename(input)
var separated = separate(src, url, root, base);
if (isStream(input)) {
return input.end(separated.json, 'utf8', done);
}
mkdirp(path.dirname(input), function (err) {
if (err) return done(err);
function isWritable(stream) {
return isStream.writable(stream) && commonCheck(stream);
}
function isWritable(stream) {
return isStream.writable(stream)
}