How to use the etcher-sdk.multiWrite function in etcher-sdk

To help you get started, we’ve selected a few etcher-sdk 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 balena-io / etcher / lib / gui / modules / child-writer.js View on Github external
const writeAndValidate = async (source, destinations, verify, trim, onProgress, onFail) => {
  let innerSource = await source.getInnerSource()
  if (trim && (await innerSource.canRead())) {
    innerSource = new sdk.sourceDestination.ConfiguredSource(
      innerSource,
      trim,

      // Create stream from file-disk (not source stream)
      true
    )
  }
  const { failures, bytesWritten } = await sdk.multiWrite.pipeSourceToDestinations(
    innerSource,
    destinations,
    onFail,
    onProgress,
    verify
  )
  const result = {
    bytesWritten,
    devices: {
      failed: failures.size,
      successful: destinations.length - failures.size
    },
    errors: []
  }
  for (const [ destination, error ] of failures) {
    error.device = destination.drive.device

etcher-sdk

Etcher SDK

Apache-2.0
Latest version published 11 days ago

Package Health Score

67 / 100
Full package analysis