How to use the etcher-sdk.scanner 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 / app / modules / drive-scanner.js View on Github external
const adapters = [
  new sdk.scanner.adapters.BlockDeviceAdapter(includeSystemDrives)
]

// Can't use permissions.isElevated() here as it returns a promise and we need to set
// module.exports = scanner right now.
// eslint-disable-next-line no-magic-numbers
if ((process.platform !== 'linux') || (process.geteuid() === 0)) {
  adapters.push(new sdk.scanner.adapters.UsbbootDeviceAdapter())
}

if (process.platform === 'win32') {
  adapters.push(new sdk.scanner.adapters.DriverlessDeviceAdapter())
}

const scanner = new sdk.scanner.Scanner(adapters)

module.exports = scanner
github balena-io / etcher / lib / gui / app / modules / drive-scanner.js View on Github external
/**
 * @summary returns true if system drives should be shown
 * @function
 *
 * @returns {Boolean}
 *
 * @example
 * const shouldInclude = includeSystemDrives()
 */
const includeSystemDrives = () => {
  return settings.get('unsafeMode') && !settings.get('disableUnsafeMode')
}

const adapters = [
  new sdk.scanner.adapters.BlockDeviceAdapter(includeSystemDrives)
]

// Can't use permissions.isElevated() here as it returns a promise and we need to set
// module.exports = scanner right now.
// eslint-disable-next-line no-magic-numbers
if ((process.platform !== 'linux') || (process.geteuid() === 0)) {
  adapters.push(new sdk.scanner.adapters.UsbbootDeviceAdapter())
}

if (process.platform === 'win32') {
  adapters.push(new sdk.scanner.adapters.DriverlessDeviceAdapter())
}

const scanner = new sdk.scanner.Scanner(adapters)

module.exports = scanner

etcher-sdk

Etcher SDK

Apache-2.0
Latest version published 2 months ago

Package Health Score

64 / 100
Full package analysis