Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await new Promise((resolve, reject) => {
splitFile.splitFileBySize(`.meteor/local/builds/${dockerfile.buildzip}`, 999999, async (err, names) => {
if (err) {
reject(err);
}
// delete original bundle file so that it doesnt get uploaded to now
await del.promise([`.meteor/local/builds/${dockerfile.buildzip}`]);
resolve(names);
});
});
};
fs.createReadStream(filePath).pipe(fs.createWriteStream(dest)).on('finish', () => {
splitFile.splitFileBySize(dest, 1024 * 1024)
.then((files) => {
async.map(files, (file, cb) => {
md5File(file, (err, hash) => {
if (err) {
return cb(err);
}
const finalFilePath = path.join(storeDir, hash);
fs.rename(file, finalFilePath, (err) => {
if (err) {
return cb(err);
}
cb(null, {
path: finalFilePath,
name: hash
export const prepareBundle = async () => {
const bundlePath = `${meteorNowBuildPath}/${tarFileName}`;
await tar.x({
file: bundlePath,
cwd: meteorNowBuildPath,
}, ['bundle/programs/server/package.json']);
try {
if (getArg('nosplit')) {
renameFile(bundlePath, `${meteorNowBuildPath}/bundle.tar.gz`);
} else {
logger.debug('splitting bundle');
await splitFile.splitFileBySize(
`${meteorNowBuildPath}/${tarFileName}`,
999999,
);
await deletePath(bundlePath);
}
} catch (e) {
logger.error(e);
}
};