Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async pushAppBundle (app, timeout = DEFAULT_ITEM_PUSH_TIMEOUT) {
const timer = new timing.Timer().start();
const afcService = await services.startAfcService(this.udid);
// We are pushing serially due to this https://github.com/appium/appium/issues/13115. There is nothing else we can do besides this
try {
const bundlePathOnPhone = await this.createAppPath(afcService, app);
await fs.walkDir(app, true, async (itemPath, isDir) => {
const pathOnPhone = path.join(bundlePathOnPhone, path.relative(app, itemPath));
if (isDir) {
await afcService.createDirectory(pathOnPhone);
} else {
const readStream = fs.createReadStream(itemPath, {autoClose: true});
const writeStream = await afcService.createWriteStream(pathOnPhone, {autoDestroy: true});
writeStream.on('finish', writeStream.destroy);
const itemPushWait = new B((resolve, reject) => {
writeStream.on('close', resolve);
const onStreamError = (e) => {
readStream.unpipe(writeStream);
reject(e);
async function createAfcClient (udid, bundleId, containerType) {
if (!bundleId) {
return await services.startAfcService(udid);
}
const service = await services.startHouseArrestService(udid);
if (isDocuments(containerType)) {
return await service.vendDocuments(bundleId);
} else {
return await service.vendContainer(bundleId);
}
}