How to use the node-simctl.addMedia function in node-simctl

To help you get started, we’ve selected a few node-simctl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appium / appium-xcuitest-driver / lib / commands / file-movement.js View on Github external
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);
  }
}
github appium / appium-xcuitest-driver / lib / commands / actions.js View on Github external
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);
  }
}