Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const {bundleId, pathInContainer: dstPath} = await parseContainerPath(remotePath,
async (appBundle, containerType) => await getAppContainer(device.udid, appBundle, null, containerType));
log.info(`Parsed bundle identifier '${bundleId}' from '${remotePath}'. ` +
`Will put the data into '${dstPath}'`);
if (!await fs.exists(path.dirname(dstPath))) {
log.debug(`The destination folder '${path.dirname(dstPath)}' does not exist. Creating...`);
await mkdirp(path.dirname(dstPath));
}
await fs.writeFile(dstPath, buffer);
return;
}
const dstFolder = await tempDir.openDir();
const dstPath = path.resolve(dstFolder, path.basename(remotePath));
try {
await fs.writeFile(dstPath, buffer);
await addMedia(device.udid, dstPath);
} finally {
await fs.rimraf(dstFolder);
}
}
const [bundleId, dstPath] = await parseContainerPath(remotePath,
async (x) => await getAppContainer(device.udid, x));
log.info(`Parsed bundle identifier '${bundleId}' from '${remotePath}'. ` +
`Will put the data into '${dstPath}'`);
if (!await fs.exists(path.dirname(dstPath))) {
log.debug(`The destination folder '${path.dirname(dstPath)}' does not exist. Creating...`);
await fs.mkdirp(path.dirname(dstPath));
}
await fs.writeFile(dstPath, new Buffer(base64Data, 'base64').toString('binary'), 'binary');
return;
}
const dstFolder = await tempDir.tempDir();
const dstPath = path.resolve(dstFolder, path.basename(remotePath));
try {
await fs.writeFile(dstPath, new Buffer(base64Data, 'base64').toString('binary'), 'binary');
await addMedia(device.udid, dstPath);
} finally {
await fs.rimraf(dstFolder);
}
}