• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript os.arch函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中os.arch函数的典型用法代码示例。如果您正苦于以下问题:TypeScript arch函数的具体用法?TypeScript arch怎么用?TypeScript arch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了arch函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: acquireNodeFromFallbackLocation

// For non LTS versions of Node, the files we need (for Windows) are sometimes located
// in a different folder than they normally are for other versions.
// Normally the format is similar to: https://nodejs.org/dist/v5.10.1/node-v5.10.1-win-x64.7z
// In this case, there will be two files located at:
//      /dist/v5.10.1/win-x64/node.exe
//      /dist/v5.10.1/win-x64/node.lib
// If this is not the structure, there may also be two files located at:
//      /dist/v0.12.18/node.exe
//      /dist/v0.12.18/node.lib
// This method attempts to download and cache the resources from these alternative locations.
// Note also that the files are normally zipped but in this case they are just an exe
// and lib file in a folder, not zipped.
async function acquireNodeFromFallbackLocation(version: string): Promise<string> {
    // Create temporary folder to download in to
    let tempDownloadFolder: string = 'temp_' + Math.floor(Math.random() * 2000000000);
    let tempDir: string = path.join(taskLib.getVariable('agent.tempDirectory'), tempDownloadFolder);
    taskLib.mkdirP(tempDir);
    let exeUrl: string;
    let libUrl: string;
    try {
        exeUrl = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.exe`;
        libUrl = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.lib`;

        await toolLib.downloadTool(exeUrl, path.join(tempDir, "node.exe"));
        await toolLib.downloadTool(libUrl, path.join(tempDir, "node.lib"));
    }
    catch (err) {
        if (err['httpStatusCode'] && 
            err['httpStatusCode'] === '404')
        {
            exeUrl = `https://nodejs.org/dist/v${version}/node.exe`;
            libUrl = `https://nodejs.org/dist/v${version}/node.lib`;

            await toolLib.downloadTool(exeUrl, path.join(tempDir, "node.exe"));
            await toolLib.downloadTool(libUrl, path.join(tempDir, "node.lib"));
        }
        else {
            throw err;
        }
    }
    return await toolLib.cacheDir(tempDir, 'node', version);
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:42,代码来源:installer.ts


示例2: sys

export function sys() {
	if (os.platform() === 'linux') {
		if (os.arch() === 'arm') return '-linuxarm';
		else if (os.arch() === 'x64') return '-linux64';
		else return '-linux32';
	}
	else if (os.platform() === 'win32') {
		return '.exe';
	}
	else {
		return '-osx';
	}
}
开发者ID:hammeron-art,项目名称:khamake,代码行数:13,代码来源:exec.ts


示例3: acquireNodeFromFallbackLocation

// For non LTS versions of Node, the files we need (for Windows) are sometimes located
// in a different folder than they normally are for other versions.
// Normally the format is similar to: https://nodejs.org/dist/v5.10.1/node-v5.10.1-win-x64.7z
// In this case, there will be two files located at:
//      /dist/v5.10.1/win-x64/node.exe
//      /dist/v5.10.1/win-x64/node.lib
// This method attempts to download and cache the resources from this alternative location.
// Note also that the files are normally zipped but in this case they are just an exe
// and lib file in a folder, not zipped.
async function acquireNodeFromFallbackLocation(version: string): Promise<string> {
    let exeUrl: string = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.exe`;
    let libUrl: string = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.lib`;

    // Create temporary folder to download in to
    let tempDownloadFolder: string = 'temp_' + Math.floor(Math.random() * 2000000000);
    let tempDir: string = path.join(taskLib.getVariable('agent.tempDirectory'), tempDownloadFolder);
    taskLib.mkdirP(tempDir);

    let exeDownloadPath: string = await toolLib.downloadTool(exeUrl, path.join(tempDir, "node.exe"));
    let libDownloadPath: string = await toolLib.downloadTool(libUrl, path.join(tempDir, "node.lib"));

    return await toolLib.cacheDir(tempDir, 'node', version);
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:23,代码来源:nodetool.ts


示例4: downloadBinary

 /**
  * Download the binary file.
  * @param binary The binary of interest.
  * @param outputDir The directory where files are downloaded and stored.
  * @param opt_proxy The proxy for downloading files.
  * @param opt_ignoreSSL To ignore SSL.
  * @param opt_callback Callback method to be executed after the file is downloaded.
  */
 static downloadBinary(
     binary: Binary, outputDir: string, opt_proxy?: string,
     opt_ignoreSSL?: boolean, opt_callback?: Function): void {
   logger.info(binary.name + ': downloading version ' + binary.version());
   var url = binary.url(os.type(), os.arch());
   if (!url) {
     logger.error(binary.name + ' v' + binary.version() + ' is not available for your system.');
     return;
   }
   Downloader.httpGetFile_(
       url, binary.filename(os.type(), os.arch()), outputDir, opt_proxy, opt_ignoreSSL, (filePath: string) => {
         if (opt_callback) {
           opt_callback(binary, outputDir, filePath);
         }
       });
 }
开发者ID:rayrapetyan,项目名称:webdriver-manager,代码行数:24,代码来源:downloader.ts


示例5: machineId

 return machineId().catch(() => {
   // In case MachineId fails
   const hash = crypto.createHash('sha256')
   const network = os.networkInterfaces()
   hash.update(os.arch() + os.hostname() + os.platform() + os.type() + network['mac'])
   return hash.digest('hex')
 })
开发者ID:alexsandrocruz,项目名称:botpress,代码行数:7,代码来源:stats.ts


示例6: register

register("package", async (runner, releaseTag) => {
	if (!releaseTag) {
		throw new Error("Please specify the release tag.");
	}

	const releasePath = path.resolve(__dirname, "../release");

	const archiveName = `code-server-${releaseTag}-${os.platform()}-${os.arch()}`;
	const archiveDir = path.join(releasePath, archiveName);
	fse.removeSync(archiveDir);
	fse.mkdirpSync(archiveDir);

	const binaryPath = path.join(__dirname, `../packages/server/cli-${os.platform()}-${os.arch()}`);
	const binaryDestination = path.join(archiveDir, "code-server");
	fse.copySync(binaryPath, binaryDestination);
	fs.chmodSync(binaryDestination, "755");
	["README.md", "LICENSE"].forEach((fileName) => {
		fse.copySync(path.resolve(__dirname, `../${fileName}`), path.join(archiveDir, fileName));
	});

	runner.cwd = releasePath;
	await os.platform() === "linux"
		? runner.execute("tar", ["-cvzf", `${archiveName}.tar.gz`, `${archiveName}`])
		: runner.execute("zip", ["-r", `${archiveName}.zip`, `${archiveName}`]);
});
开发者ID:AhmadAlyTanany,项目名称:code-server,代码行数:25,代码来源:tasks.ts


示例7: update

/**
 * Parses the options and downloads binaries if they do not exist.
 * @param options
 */
function update(options: Options): void {
  let standalone = options[Opt.STANDALONE].getBoolean();
  let chrome = options[Opt.CHROME].getBoolean();
  let ie: boolean = false;
  let ie32: boolean = false;
  if (options[Opt.IE]) {
    ie = options[Opt.IE].getBoolean();
  }
  if (options[Opt.IE32]) {
    ie32 = options[Opt.IE32].getBoolean();
  }
  let outputDir = Config.getSeleniumDir();
  if (options[Opt.OUT_DIR].getString()) {
    if (path.isAbsolute(options[Opt.OUT_DIR].getString())) {
      outputDir = options[Opt.OUT_DIR].getString();
    } else {
      outputDir = path.resolve(Config.getBaseDir(), options[Opt.OUT_DIR].getString());
    }
    FileManager.makeOutputDirectory(outputDir);
  }
  let ignoreSSL = options[Opt.IGNORE_SSL].getBoolean();
  let proxy = options[Opt.PROXY].getString();

  // setup versions for binaries
  let binaries = FileManager.setupBinaries();
  binaries[StandAlone.id].versionCustom = options[Opt.VERSIONS_STANDALONE].getString();
  binaries[ChromeDriver.id].versionCustom = options[Opt.VERSIONS_CHROME].getString();
  if (options[Opt.VERSIONS_IE]) {
    binaries[IEDriver.id].versionCustom = options[Opt.VERSIONS_IE].getString();
  }

  // if the file has not been completely downloaded, download it
  // else if the file has already been downloaded, unzip the file, rename it, and give it permissions
  if (standalone) {
    let binary = binaries[StandAlone.id];
    FileManager.toDownload(binary, outputDir).then((value: boolean) => {
      if (value) {
        Downloader.downloadBinary(binary, outputDir);
      } else {
        logger.info(binary.name + ': file exists ' + path.resolve(outputDir, binary.filename(os.type(), os.arch())));
        logger.info(binary.name + ': v' + binary.versionCustom + ' up to date');
      }
    });
  }
  if (chrome) {
    let binary = binaries[ChromeDriver.id];
    updateBinary(binary, outputDir, proxy, ignoreSSL);
  }
  if (ie) {
    let binary = binaries[IEDriver.id];
    binary.arch = os.arch(); // Win32 or x64
    updateBinary(binary, outputDir, proxy, ignoreSSL);
  }
  if (ie32) {
    let binary = binaries[IEDriver.id];
    binary.arch = 'Win32';
    updateBinary(binary, outputDir, proxy, ignoreSSL);
  }
}
开发者ID:avatar-7,项目名称:webdriver-manager,代码行数:63,代码来源:update.ts


示例8:

 handler: () => ({
   hostname: os.hostname(),
   arch: os.arch(),
   platfoirm: os.platform(),
   cpus: os.cpus().length,
   totalmem: humanize.filesize(os.totalmem()),
   networkInterfaces: os.networkInterfaces()
 })
开发者ID:pdxmholmes,项目名称:alpine-node-hello,代码行数:8,代码来源:index.ts


示例9:

 FileManager.toDownload(binary, outputDir).then((value: boolean) => {
   if (value) {
     Downloader.downloadBinary(binary, outputDir);
   } else {
     logger.info(
         binary.name + ': file exists ' +
         path.resolve(outputDir, binary.filename(os.type(), os.arch())));
     logger.info(binary.name + ': v' + binary.versionCustom + ' up to date');
   }
 });
开发者ID:hu19891110,项目名称:webdriver-manager,代码行数:10,代码来源:update.ts


示例10: unzip

 return FileManager.toDownload(binary, outputDir).then((value: boolean) => {
   if (value) {
     let deferred = q.defer();
     Downloader.downloadBinary(
         binary, outputDir, proxy, ignoreSSL,
         (binary: Binary, outputDir: string, fileName: string) => {
           unzip(binary, outputDir, fileName);
           deferred.resolve();
         });
     return deferred.promise;
   } else {
     logger.info(
         binary.name + ': file exists ' +
         path.resolve(outputDir, binary.filename(os.type(), os.arch())));
     let fileName = binary.filename(os.type(), os.arch());
     unzip(binary, outputDir, fileName);
     logger.info(binary.name + ': v' + binary.versionCustom + ' up to date');
   }
 });
开发者ID:hu19891110,项目名称:webdriver-manager,代码行数:19,代码来源:update.ts



注:本文中的os.arch函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript os.cpus函数代码示例发布时间:2022-05-25
下一篇:
TypeScript original-fs.realpathSync函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap