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((resolve, reject) => {
let readStream: NodeJS.ReadableStream = fsAsPromised.createReadStream(fromFilename, { encoding: 'utf8' });
const writeStream = fsAsPromised.createWriteStream(toFilename);
readStream.on('error', reject);
writeStream.on('error', reject);
if (instrumenter) {
readStream = readStream.pipe(instrumenter);
}
readStream.pipe(writeStream);
readStream.on('end', () => resolve());
});
}
return new Promise((resolve, reject) => {
let readStream: NodeJS.ReadableStream = fsAsPromised.createReadStream(fromFilename, { encoding: 'utf8' });
const writeStream = fsAsPromised.createWriteStream(toFilename);
readStream.on('error', reject);
writeStream.on('error', reject);
if (instrumenter) {
readStream = readStream.pipe(instrumenter);
}
readStream.pipe(writeStream);
readStream.on('end', () => resolve());
});
}
return new Promise((resolve, reject) => {
const readStream = fsAsPromised.createReadStream(fromFilename);
const writeStream = fsAsPromised.createWriteStream(toFilename);
readStream.on('error', reject);
writeStream.on('error', reject);
readStream.pipe(writeStream);
readStream.on('end', resolve);
});
}