当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript tar.create函数代码示例

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


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

示例1: _tar

function _tar(out: string, dir: string) {
  return tar.create({
    gzip: true,
    strict: true,
    portable: true,
    cwd: dir,
    file: out,
    sync: true,
  }, ['.']);
}
开发者ID:fmalcher,项目名称:angular-cli,代码行数:10,代码来源:build.ts

示例2: async

export const createArchive = async (fileName: string, folder: string, files: string[]): Promise<string> => {
  try {
    await tar.create(
      {
        cwd: folder,
        file: fileName,
        portable: true,
        gzip: true
      },
      files
    )
    return fileName
  } catch (err) {
    throw new VError(err, `[Archive] Error creating archive "${fileName}"`)
  }
}
开发者ID:alexsandrocruz,项目名称:botpress,代码行数:16,代码来源:archive.ts

示例3: zipFiles

async function zipFiles(modulePath, outPath) {
  const packageJson = require(path.join(modulePath, 'package.json'))
  outPath = outPath.replace(/%name%/gi, packageJson.name.replace(/[^\w-]/gi, '_'))
  outPath = outPath.replace(/%version%/gi, packageJson.version.replace(/[^\w-]/gi, '_'))

  if (!path.isAbsolute(outPath)) {
    outPath = path.join(modulePath, outPath)
  }

  debug(`Writing to "${outPath}"`)

  const files = glob.sync('**/*', {
    cwd: modulePath,
    nodir: true,
    ignore: ['node_modules/**', 'src/**']
  })

  debug(`Zipping ${files.length} files...`)

  await tar.create({ gzip: true, follow: true, file: outPath, portable: true }, files)
}
开发者ID:seffalabdelaziz,项目名称:botpress,代码行数:21,代码来源:package.ts

示例4: _tar

// This method mimics how npm pack tars packages.
function _tar(out: string, dir: string) {
  // NOTE: node-tar does some Magic Stuff depending on prefixes for files
  //       specifically with @ signs, so we just neutralize that one
  //       and any such future "features" by prepending `./`

  // Without this, the .tar file cannot be opened on Windows.

  const files = _recursiveFileList(dir).map((f) => `./${f}`);

  return tar.create({
    gzip: true,
    strict: true,
    portable: true,
    cwd: dir,
    prefix: 'package/',
    file: out,
    sync: true,
    // Provide a specific date in the 1980s for the benefit of zip,
    // which is confounded by files dated at the Unix epoch 0.
    mtime: new Date('1985-10-26T08:15:00.000Z'),
  }, files);
}
开发者ID:DevIntent,项目名称:angular-cli,代码行数:23,代码来源:build.ts

示例5: tarFiles

function tarFiles(out: string, dir: string): Promise<void> {
  // const files = fs.readdirSync(dir);
  return tar.create({ gzip: true, strict: true, portable: true, cwd: dir, file: out }, ['.']);
}
开发者ID:headinclouds,项目名称:angular-cli,代码行数:4,代码来源:build.ts


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