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

TypeScript fs-extra-p.readdir函数代码示例

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

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



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

示例1: deleteOldElectronVersion

async function deleteOldElectronVersion(): Promise<any> {
  if (!process.env.CI) {
    return
  }

  const cacheDir = path.join(require("os").homedir(), ".electron")
  try {
    const deletePromises: Array<Promise<any>> = []
    for (let file of (await readdir(cacheDir))) {
      if (file.endsWith(".zip") && !file.includes(electronVersion)) {
        console.log("Remove old electron " + file)
        deletePromises.push(unlink(path.join(cacheDir, file)))
      }
    }
    return BluebirdPromise.all(deletePromises)
  }
  catch (e) {
    if (e.code === "ENOENT") {
      return []
    }
    else {
      throw e
    }
  }
}
开发者ID:MathijsvVelde,项目名称:electron-builder,代码行数:25,代码来源:runTests.ts


示例2: main

async function main(): Promise<void> {
  const packages = (await readdir(packageDir)).filter(it => !it.includes(".")).sort()
  const devPackageData = await readJson(path.join(rootDir, "package.json"))
  if ((await BluebirdPromise.map(packages, it => check(path.join(packageDir, it), devPackageData))).includes(false)) {
    process.exitCode = 1
  }
}
开发者ID:jwheare,项目名称:electron-builder,代码行数:7,代码来源:checkDeps.ts


示例3: readScopedDir

async function readScopedDir(dir: string) {
  let files: Array<string>
  try {
    files = (await readdir(dir)).filter(it => !it.startsWith("."))
  }
  catch (e) {
    // error indicates that nothing is installed here
    return []
  }

  files.sort()

  const scopes = files.filter(it => it.startsWith("@"))
  if (scopes.length === 0) {
    return files
  }

  const result = files.filter(it => !it.startsWith("@"))
  const scopeFileList = await BluebirdPromise.map(scopes, it => readdir(path.join(dir, it)))
  for (let i = 0; i < scopes.length; i++) {
    for (const file of scopeFileList[i]) {
      if (!file.startsWith(".")) {
        result.push(`${scopes[i]}/${file}`)
      }
    }
  }

  result.sort()
  return result
}
开发者ID:djpereira,项目名称:electron-builder,代码行数:30,代码来源:readInstalled.ts


示例4: deleteOldElectronVersion

async function deleteOldElectronVersion(): Promise<any> {
  if (!isCi) {
    return
  }

  const cacheDir = require("env-paths")("electron", {suffix: ""}).cache
  try {
    const deletePromises: Array<Promise<any>> = []
    for (const file of (await readdir(cacheDir))) {
      if (file.endsWith(".zip") && !file.includes(ELECTRON_VERSION)) {
        console.log(`Remove old electron ${file}`)
        deletePromises.push(unlink(path.join(cacheDir, file)))
      }
    }
    return await BluebirdPromise.all(deletePromises)
  }
  catch (e) {
    if (e.code === "ENOENT") {
      return []
    }
    else {
      throw e
    }
  }
}
开发者ID:djpereira,项目名称:electron-builder,代码行数:25,代码来源:runTests.ts


示例5: deleteOldElectronVersion

function deleteOldElectronVersion(): Promise<any> {
  if (process.env.CI) {
    const cacheDir = path.join(require("os").homedir(), ".electron")
    return fs.readdir(cacheDir)
      .catch(error => {
        if (error.code === "ENOENT") {
          return []
        }
        else {
          throw error
        }
      })
      .then(it => {
        const deletePromises: Array<Promise<any>> = []
        for (let file of it) {
          if (file.endsWith(".zip") && !file.includes(electronVersion)) {
            console.log("Remove old electron " + file)
            deletePromises.push(fs.unlink(path.join(cacheDir, file)))
          }
        }
        return BluebirdPromise.all(deletePromises)
      })
  }
  else {
    return BluebirdPromise.resolve()
  }
}
开发者ID:waifei,项目名称:electron-builder,代码行数:27,代码来源:runTests.ts


示例6: readScopedDir

async function readScopedDir(dir: string): Promise<Array<string> | null> {
  let files: Array<string>
  try {
    files = (await readdir(dir)).filter(it => !it.startsWith(".") && !knownAlwaysIgnoredDevDeps.has(it))
  }
  catch (e) {
    // error indicates that nothing is installed here
    return null
  }

  files.sort()

  const scopes = files.filter(it => it.startsWith("@") && it !== "@types")
  if (scopes.length === 0) {
    return files
  }

  const result = files.filter(it => !it.startsWith("@"))
  const scopeFileList = await BluebirdPromise.map(scopes, it => readdir(path.join(dir, it)))
  for (let i = 0; i < scopes.length; i++) {
    const list = scopeFileList[i]
    list.sort()
    for (const file of list) {
      if (!file.startsWith(".")) {
        result.push(`${scopes[i]}/${file}`)
      }
    }
  }

  return result
}
开发者ID:yuya-oc,项目名称:electron-builder,代码行数:31,代码来源:packageDependencies.ts


示例7: readProjectMetadata

async function readProjectMetadata(packageDir: string) {
  const packageDirs = BluebirdPromise.filter((await readdir(packageDir)).filter(it => !it.includes(".")).sort(), it => {
    return stat(path.join(packageDir, it, "package.json"))
      .then(it => it.isFile())
      .catch(() => false)
  })
  return await BluebirdPromise.map(packageDirs, it => readJson(path.join(packageDir, it, "package.json")), {concurrency: 8})
}
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:8,代码来源:setVersions.ts


示例8: computeData

export async function computeData(resourcesPath: string, options?: AsarIntegrityOptions | null): Promise<AsarIntegrity> {
  // sort to produce constant result
  const names = (await readdir(resourcesPath)).filter(it => it.endsWith(".asar")).sort()
  const checksums = await BluebirdPromise.map(names, it => hashFile(path.join(resourcesPath, it)))

  const result: { [key: string]: string; } = {}
  for (let i = 0; i < names.length; i++) {
    result[names[i]] = checksums[i]
  }
  return {checksums: result, ...options}
}
开发者ID:jwheare,项目名称:electron-builder,代码行数:11,代码来源:main.ts


示例9: main

async function main(): Promise<void> {
  const packages = (await readdir(packageDir)).filter(it => !it.includes(".")).sort()

  const packageData = await BluebirdPromise.map(packages, it => readJson(path.join(packageDir, it, "package.json")))
  const args = process.argv.slice(2)
  if (args.length > 0 && args[0] === "p") {
    await setPackageVersions(packages, packageData)
  }
  else {
    await setDepVersions(packages, packageData)
  }
}
开发者ID:mbrainiac,项目名称:electron-builder,代码行数:12,代码来源:setVersions.ts


示例10: main

async function main(): Promise<void> {
  const packages = (await readdir(packageDir)).filter(it => !it.includes(".")).sort()
  for (const name of packages) {
    if (name.includes("electron-forge-maker-") || name.includes("electron-installer-")) {
      continue
    }

    workers(path.join(packageDir, name), (error: Error, hasError: boolean) => {
      if (hasError) {
        process.exitCode = 1
      }
    })
  }
  workerFarm.end(workers)
}
开发者ID:electron-userland,项目名称:electron-builder,代码行数:15,代码来源:lint.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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