How to use the os.arch function in os

To help you get started, we’ve selected a few os 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 lightninglabs / lightning-app / apps / desktop / scripts / package.js View on Github external
).then(() => {
    if (shouldBuildAll) {
      const archs = ['x64']
      const platforms = ['linux', 'win32', 'darwin']

      platforms.forEach((plat) => {
        archs.forEach((arch) => {
          pack(plat, arch, log(plat, arch))
        })
      })
    } else {
      // build for current platform only
      pack(os.platform(), os.arch(), log(os.platform(), os.arch()))
    }
  }).catch((error) => {
    console.log('Error:', JSON.stringify(error, null, 2))
github jperler / bezie / package.js View on Github external
.then(paths => {
      if (shouldBuildAll) {
        // build for all platforms
        const archs = ['ia32', 'x64'];
        const platforms = ['linux', 'win32', 'darwin'];

        platforms.forEach(plat => {
          archs.forEach(arch => {
            pack(plat, arch, log(plat, arch));
          });
        });
      } else {
        // build for current platform only
        pack(os.platform(), os.arch(), log(os.platform(), os.arch()));
      }
    })
    .catch(err => {
github bbyars / mountebank / tasks / install.js View on Github external
function bitness () {
    if (os.arch() === 'x64') {
        return 'x64';
    }
    else {
        // avoid "ia32" result on windows
        return 'x86';
    }
}
github microsoft / azure-pipelines-tasks / Tasks / UseGoV1 / installer.ts View on Github external
import * as toolLib from 'azure-pipelines-tool-lib/tool';
import * as tl from 'azure-pipelines-task-lib/task';

import * as path from 'path';
import * as util from 'util';
import * as os from 'os';

const osPlat: string = os.platform();
let osArch: string = tl.getInput('architecture', false);
if (!osArch) {
    osArch = os.arch();
}
if (osArch != 'x64' && osArch != 'x32') {
    throw new Error('Invalid architecture ' + osArch);
}

export async function getGo(version: string) {
    // check cache
    let toolPath: string;
    toolPath = toolLib.findLocalTool('go', normalizeVersion(version));

    if (!toolPath) {
        // download, extract, cache
        toolPath = await acquireGo(version);
        tl.debug("Go tool is cached under " + toolPath);
    }
github kevinGodell / ffmpeg-streamer / lib / configure.js View on Github external
let ffmpegPath;
    let ffmpegVersion;

    if (process.pkg && process.pkg.entrypoint) {
        dirName = path.dirname(process.execPath);
    } else {
        dirName = process.cwd();
    }

    switch (os.platform()) {
        case 'win32':
            osType = `Windows_${os.arch()}`;
            ffmpegLocalPath = path.resolve(`${dirName}/ffmpeg.exe`);
            break;
        case 'linux':
            osType = `Linux_${os.arch()}`;
            ffmpegLocalPath = path.resolve(`${dirName}/ffmpeg`);
            break;
        case 'darwin':
            osType = `macOS_${os.arch()}`;
            ffmpegLocalPath = path.resolve(`${dirName}/ffmpeg`);
            break;
        default :
            throw new Error('unable to determine operating system');
    }

    if (fs.existsSync(ffmpegLocalPath)) {
        try {
            fs.accessSync(ffmpegLocalPath, fs.constants.X_OK);
            ffmpegPath = ffmpegLocalPath;
        } catch (err) {
            console.error(err.message);
github sayanee / iot-security-lecture / demo / server.js View on Github external
function isMacBook() {
  return os.arch() === 'x64' ? true : false
}
github subosito / flutter-action / node_modules / @actions / tool-cache / lib / tool-cache.js View on Github external
function findAllVersions(toolName, arch) {
    const versions = [];
    arch = arch || os.arch();
    const toolPath = path.join(cacheRoot, toolName);
    if (fs.existsSync(toolPath)) {
        const children = fs.readdirSync(toolPath);
        for (const child of children) {
            if (_isExplicitVersion(child)) {
                const fullPath = path.join(toolPath, child, arch || '');
                if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
                    versions.push(child);
                }
            }
        }
    }
    return versions;
}
exports.findAllVersions = findAllVersions;
github develar / electron-updater / lib / context.js View on Github external
fs.readFile(pendingUpdatePath, {encoding: 'utf8'}, function (err, updateContents) {
            var updatePending = !err && updateContents === 'PENDING'
            var updateInProgress = !err && updateContents === 'INPROGRESS'
            var ctx = {
              name: name,
              version: version,
              publisher: publisher,
              channel: channel,
              dev: dev,
              platform: os.platform(),
              arch: os.arch(),
              configuration: dev ? 'debug' : 'release',
              updatePending: updatePending,
              updateInProgress: updateInProgress,
              registry: registry,
              appDir: appDir,
              dependencies: package.dependencies || {},
              plugins: package.plugins || {}
            }
            callback(null, ctx)
          })
        })
github irccloud / irccloud-desktop / app / crash_reporter.js View on Github external
let config_promise = new Promise((resolve, reject) => {
    let config = {
      release: app.getVersion(),
      environment: is.dev() ? 'development' : 'production',
      name: osName(),
      tags: {
        os_arch: os.arch(),
        os_platform: os.platform(),
        os_release: os.release(),
        os_version: process.getSystemVersion(),
        os_type: os.type(),
        os_totalmem: os_totalmem_gb + 'GB',
        hostname: app.config.get('host'),
        user_style: app.config.get('acceptUserStyles'),
        user_script: app.config.get('acceptUserScripts'),
        tray: app.config.get('tray'),
        menu_bar: app.config.get('menu-bar')
      },
      dataCallback: (data) => {
        if (user) {
          data.user = {
            id: user.id,
            name: user.name,
github esy / esy / scripts / make-platform-release.windows.js View on Github external
const getArch = () => {
  let arch = os.arch() == ('x32' || 'ia32') ? 'x86' : 'x64';

  if (process.env.APPVEYOR) {
    arch = process.env.PLATFORM === 'x86' ? 'x86' : 'x64';
  }

  return arch;
};