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

TypeScript os.hostname函数代码示例

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

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



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

示例1: encrypt

function encrypt(username, password) {

    //OS.hostname() is the key.
    //AES encryption
       
    encryptedUsername = CryptoJS.AES.encrypt(username, os.hostname());
    encryptedPassword = CryptoJS.AES.encrypt(password, os.hostname());


    writetoJSON(encryptedUsername, encryptedPassword);
    
}
开发者ID:cchampernowne,项目名称:project-seed,代码行数:12,代码来源:storeCredentials.ts


示例2: function

var workerProcess = child_process.exec(`cd ${libPath} && npm test`, bufferOption, function (error, stdout, stderr) {
    clearTimeout(timeoutId);

    if (error) {
        //console.log(error.stack);
        //console.log('MPN Error code: ' + error.code);
        //console.log('MPNSignal received: ' + error.signal);
        console.log(`{"sucess":"false", "host":"${os.hostname()}", "duration":"${clock(start)}"}`);
        process.exit(error.code);
    }
    //console.log('MPN stdout: ' + stdout);
    //console.log('MPNstderr: ' + stderr);
    console.log(`{"sucess":"true", "host":"${os.hostname()}", "duration":"${clock(start)}"}`);
    process.exit();
});
开发者ID:ffarzat,项目名称:JavaScriptHeuristicOptmizer,代码行数:15,代码来源:client.ts


示例3: getPassword

function getPassword() {
  var decryptedPasswordBytes = CryptoJS.AES.decrypt(
    encryptedPassword.toString(),
    os.hostname()
  );
  return decryptedPasswordBytes.toString(CryptoJS.enc.Utf8);
}
开发者ID:cchampernowne,项目名称:project-seed,代码行数:7,代码来源:readCredentials.ts


示例4: 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


示例5: extractFullyQualifiedDomainName

export async function extractFullyQualifiedDomainName(): Promise<string> {

    if (_fullyQualifiedDomainNameInCache) {
        return _fullyQualifiedDomainNameInCache;
    }
    if (false && process.platform === "win32") {
        // http://serverfault.com/a/73643/251863
        const env = process.env;
        _fullyQualifiedDomainNameInCache = env.COMPUTERNAME
          + ((env.USERDNSDOMAIN && env.USERDNSDOMAIN!.length > 0) ? "." + env.USERDNSDOMAIN : "");

    } else {

        try {
            _fullyQualifiedDomainNameInCache = await promisify(fqdn)();
            if (/sethostname/.test(_fullyQualifiedDomainNameInCache as string)) {
                throw new Error("Detecting fqdn  on windows !!!");
            }
        } catch (err) {
            // fall back to old method
            _fullyQualifiedDomainNameInCache = os.hostname();
        }

    }
    return _fullyQualifiedDomainNameInCache!;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:26,代码来源:hostname.ts


示例6:

 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


示例7: constructor

 constructor() {
   this.name = NAME;
   this.nickname = RandomName({ last: true });
   this.hostname = os.hostname();
   this.pid = process.pid;
   this.boundLog = null;
   this.boundError = null;
 }
开发者ID:WordToken,项目名称:voice-web,代码行数:8,代码来源:logger.ts


示例8: function

controller.hears(["uptime", "identify yourself", "who are you", "what is your name"], "direct_message,direct_mention,mention", function (bot, message) {

    let hostname = os.hostname();
    let uptime = formatUptime(process.uptime());

    bot.reply(message, ":robot_face: I am a bot named <@" + bot.identity.name + ">. I have been running for " + uptime + " on " + hostname + ".");

});
开发者ID:philschonholzer,项目名称:chefbot,代码行数:8,代码来源:bot.ts


示例9: getUsername

function getUsername() {
  if (encryptedUsername != null) {
    var decryptedUsernameBytes = CryptoJS.AES.decrypt(
      encryptedUsername.toString(),
      os.hostname()
    );
    return decryptedUsernameBytes.toString(CryptoJS.enc.Utf8);
  }
}
开发者ID:cchampernowne,项目名称:project-seed,代码行数:9,代码来源:readCredentials.ts


示例10: parseRequest

export function parseRequest(
  event: Event,
  req: {
    [key: string]: any;
  },
  options?: {
    request?: boolean;
    serverName?: boolean;
    transaction?: boolean | TransactionTypes;
    user?: boolean | string[];
    version?: boolean;
  },
): Event {
  // tslint:disable-next-line:no-parameter-reassignment
  options = {
    request: true,
    serverName: true,
    transaction: true,
    user: true,
    version: true,
    ...options,
  };

  if (options.version) {
    event.extra = {
      ...event.extra,
      node: global.process.version,
    };
  }

  if (options.request) {
    event.request = {
      ...event.request,
      ...extractRequestData(req),
    };
  }

  if (options.serverName) {
    event.server_name = global.process.env.SENTRY_NAME || os.hostname();
  }

  if (options.user && req.user) {
    event.user = {
      ...event.user,
      ...extractUserData(req, options.user),
    };
  }

  if (options.transaction) {
    const transaction = extractTransaction(req, options.transaction);
    if (transaction) {
      event.transaction = transaction;
    }
  }

  return event;
}
开发者ID:getsentry,项目名称:raven-js,代码行数:57,代码来源:handlers.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript os.loadavg函数代码示例发布时间:2022-05-25
下一篇:
TypeScript os.homedir函数代码示例发布时间: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