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

TypeScript sanitize-filename.default函数代码示例

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

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



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

示例1: sanitizeFilename

 r.onloadend = () => {
   const data = {
     name: sanitizeFilename(self.visState.title.toLowerCase().replace(/\s/g, '-')),
     image: r.result,
     format: 'png'
   };
   remote.dialog.showSaveDialog(
     remote.BrowserWindow.getAllWindows()[0],
     {
       title: 'Export to Image',
       defaultPath: sanitizeFilename(data.name + '.' + data.format)
     },
     (name: string) => {
       name && writeFileSync(name, arrayBufferToBuffer(data.image));
     }
   );
 };
开发者ID:chauey,项目名称:ngrev,代码行数:17,代码来源:export-to-image.service.ts


示例2: ensureDir

export async function createSelfSignedCert(publisher: string) {
  const tmpDir = new TmpDir()
  const targetDir = process.cwd()
  const tempPrefix = path.join(await tmpDir.getTempDir({prefix: "self-signed-cert-creator"}), sanitizeFileName(publisher))
  const cer = `${tempPrefix}.cer`
  const pvk = `${tempPrefix}.pvk`

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

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

    const pfx = path.join(targetDir, `${sanitizeFileName(publisher)}.pfx`)
    await unlinkIfExists(pfx)
    await exec(path.join(vendorPath, "pvk2pfx.exe"), ["-pvk", pvk, "-spc", cer, "-pfx", pfx])
    log.info({file: pfx}, `created. Please see https://electron.build/code-signing how to use it to sign.`)

    const certLocation = "Cert:\\LocalMachine\\TrustedPeople"
    log.info({file: pfx, certLocation}, `importing. Operation will be succeed only if runned from root. Otherwise import file manually.`)
    await spawn("powershell.exe", ["Import-PfxCertificate", "-FilePath", `"${pfx}"`, "-CertStoreLocation", ""])
  }
  finally {
    await tmpDir.cleanup()
  }
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:28,代码来源:create-self-signed-cert.ts


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


示例4: getEffectiveOptions

export function getEffectiveOptions(options: CommonWindowsInstallerConfiguration, packager: WinPackager): FinalCommonWindowsInstallerOptions {
  const appInfo = packager.appInfo

  let menuCategory: string | null = null
  if (options.menuCategory != null && options.menuCategory !== false) {
    if (options.menuCategory === true) {
      const companyName = packager.appInfo.companyName
      if (companyName == null) {
        throw new InvalidConfigurationError(`Please specify "author" in the application package.json — it is required because "menuCategory" is set to true.`)
      }
      menuCategory = sanitizeFileName(companyName)
    }
    else {
      menuCategory = (options.menuCategory as string).split(/[\/\\]/).map(it => sanitizeFileName(it)).join("\\")
    }
  }

  return {
    isPerMachine: options.perMachine === true,
    isAssisted: options.oneClick === false,

    shortcutName: isEmptyOrSpaces(options.shortcutName) ? appInfo.productFilename : packager.expandMacro(options.shortcutName!!),
    isCreateDesktopShortcut: convertToDesktopShortcutCreationPolicy(options.createDesktopShortcut),
    isCreateStartMenuShortcut: options.createStartMenuShortcut !== false,
    menuCategory,
  }
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:27,代码来源:CommonWindowsInstallerConfiguration.ts


示例5: sanitizeFileName

 menuCategory = (options.menuCategory as string).split(/[\/\\]/).map(it => sanitizeFileName(it)).join("\\")
开发者ID:electron-userland,项目名称:electron-builder,代码行数:1,代码来源:CommonWindowsInstallerConfiguration.ts


示例6: constructor

  constructor(info: BuildInfo) {
    super(info)

    let executableName = this.platformSpecificBuildOptions.executableName
    this.executableName = sanitizeFileName(executableName == null ? this.appInfo.name : executableName).toLowerCase()
  }
开发者ID:heinzbeinz,项目名称:electron-builder,代码行数:6,代码来源:linuxPackager.ts


示例7: constructor

  constructor(info: Packager) {
    super(info)

    const executableName = this.platformSpecificBuildOptions.executableName
    this.executableName = sanitizeFileName(executableName == null ? this.appInfo.name.toLowerCase() : executableName)
  }
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:6,代码来源:linuxPackager.ts


示例8: normalizeFileName

export function normalizeFileName(filename: string) {
    filename = sanitize(filename.replace(/[^a-z0-9\-\.]/gi, '_'));
    if (filename[0] === '/') filename = filename.substr(1);
    return filename;
}
开发者ID:kildevaeld,项目名称:assets,代码行数:5,代码来源:utils.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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