當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript TmpDir.getTempFile方法代碼示例

本文整理匯總了TypeScript中electron-builder-util/out/tmp.TmpDir.getTempFile方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript TmpDir.getTempFile方法的具體用法?TypeScript TmpDir.getTempFile怎麽用?TypeScript TmpDir.getTempFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在electron-builder-util/out/tmp.TmpDir的用法示例。


在下文中一共展示了TmpDir.getTempFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: test

test("postpone symlink", async () => {
  const tmpDir = new TmpDir()
  const source = await tmpDir.getTempFile("src")
  const aSourceFile = path.join(source, "z", "Z")
  const bSourceFileLink = path.join(source, "B")
  await outputFile(aSourceFile, "test")
  await symlink(aSourceFile, bSourceFileLink)


  const dest = await tmpDir.getTempFile("dest")
  await copyDir(source, dest)

  await tmpDir.cleanup()
})
開發者ID:djpereira,項目名稱:electron-builder,代碼行數:14,代碼來源:filesTest.ts

示例2: main

async function main() {
  const args: any = yargs
    .option("publisher", {
      alias: ["p"],
    }).argv

  const tmpDir = new TmpDir()
  const targetDir = process.cwd()
  const tempPrefix = path.join(await tmpDir.getTempFile(""), sanitizeFileName(args.publisher))
  const cer = `${tempPrefix}.cer`
  const pvk = `${tempPrefix}.pvk`

  log('When asked to enter a password ("Create Private Key Password"), please select "None".')

  const vendorPath = path.join(await getSignVendorPath(), "windows-10", process.arch)
  await exec(path.join(vendorPath, "makecert.exe"),
    ["-r", "-h", "0", "-n", `CN=${args.publisher}`, "-eku", "1.3.6.1.5.5.7.3.3", "-pe", "-sv", pvk, cer])

  const pfx = path.join(targetDir, `${sanitizeFileName(args.publisher)}.pfx`)
  await unlinkIfExists(pfx)
  await exec(path.join(vendorPath, "pvk2pfx.exe"), ["-pvk", pvk, "-spc", cer, "-pfx", pfx])
  log(`${pfx} created. Please see https://github.com/electron-userland/electron-builder/wiki/Code-Signing how do use it to sign.`)

  const certLocation = "Cert:\\LocalMachine\\TrustedPeople"
  log(`${pfx} will be imported into ${certLocation} Operation will be succeed only if runned from root. Otherwise import file manually.`)
  await spawn("powershell.exe", ["Import-PfxCertificate", "-FilePath", `"${pfx}"`, "-CertStoreLocation", ""])
  tmpDir.cleanup()
}
開發者ID:mbrainiac,項目名稱:electron-builder,代碼行數:28,代碼來源:create-self-signed-cert.ts


注:本文中的electron-builder-util/out/tmp.TmpDir.getTempFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。