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

TypeScript jszip.folder函数代码示例

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

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



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

示例1: test

test("finds root in simple zip", () => {
  const zip = new JSZip();
  zip.folder("GFX");
  zip.folder("MGFX");
  zip.folder("SAVEGAME");

  expect(findRootInZip(zip)).toEqual(zip);
});
开发者ID:ewaldbenes,项目名称:Anno2018-js,代码行数:8,代码来源:util.test.ts


示例2: it

 it("works", async () => {
   const nar = new JSZip();
   nar.folder("ikaga").file("install.txt", install);
   nar.folder("ikaga").file("descript.txt", descript);
   const narData = await nar.generateAsync({type: "arraybuffer"});
   const dir = await NarLoader.loadFromBuffer(narData);
   assert(dir.new("descript.txt").isFileSync());
   const installInfo = dir.installInfoSync();
   assert(installInfo.type === "ghost");
   const descriptInfo = dir.descriptInfoByTypeSync("ghost");
   assert(descriptInfo.shiori === "shiolink.dll");
 });
开发者ID:Ikagaka,项目名称:NarLoader,代码行数:12,代码来源:basic.ts


示例3: downloadProject

export async function downloadProject(project: Project, uri?: string) {
  const zipFile: JSZip = new JSZip();
  let zipName: string = "wasm-project.zip";
  if (uri !== undefined) {
    zipName = `wasm-project-${uri}.zip`;
  }
  const queue: Array<{filePrefix: string; file: File}> = [];
  project.mapEachFile((f: File) => queue.push({filePrefix: "", file: f}));
  while (queue.length > 0) {
    const {filePrefix, file} = queue.shift();
    const fileName = filePrefix + file.name;
    if (file instanceof Directory) {
      file.mapEachFile(f => queue.push({filePrefix: fileName + "/", file: f}));
      zipFile.folder(fileName);
      continue;
    }
    zipFile.file(fileName, file.data);
  }
  await zipFile.generateAsync({type: "blob", mimeType: "application/zip"}).then((blob: Blob) => {
    // Creating <a> to programmatically click for downloading zip via blob's URL
    const link = document.createElement("a");
    link.download = zipName;
    link.href = URL.createObjectURL(blob);
    // A fix for making link clickable in Firefox
    // Explicity adding link to DOM for Firefox
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
  });
}
开发者ID:hleal18,项目名称:WebAssemblyStudio,代码行数:30,代码来源:download.ts


示例4:

 EXPORTED_FPS.forEach(fps => {
   const numSteps = Math.ceil(anim.duration / 1000 * fps);
   const svgs = SpriteSerializer.createSvgFrames(vl, anim, numSteps);
   const length = (numSteps - 1).toString().length;
   const fpsFolder = zip.folder(`${fps}fps`);
   svgs.forEach((s, i) => {
     fpsFolder.file(`frame${_.padStart(i.toString(), length, '0')}.svg`, s);
   });
 });
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:9,代码来源:fileexport.service.ts


示例5: findRootInZip

export function findRootInZip(zip: JSZip): JSZip {
  const gfxFolder = zip.filter(relativePath =>
    ("/" + relativePath).endsWith("/GFX/")
  );
  if (gfxFolder.length === 1) {
    return zip.folder(gfxFolder[0].name.replace("GFX/", ""));
  }
  throw new Error("Your ZIP file does not have the expected structure.");
}
开发者ID:ewaldbenes,项目名称:Anno2018-js,代码行数:9,代码来源:util.ts


示例6: asyncForEach

 await asyncForEach(EXPORTED_FPS, async (fps) => {
   const numSteps = Math.ceil(anim.duration / 1000 * fps);
   const svgSprite = await SpriteSerializer.createSvgSprite(vl, anim, numSteps);
   const cssSprite = SpriteSerializer.createCss(vl.width, vl.height, anim.duration, numSteps);
   const fileName = `sprite_${fps}fps`;
   const htmlSprite = SpriteSerializer.createHtml(`${fileName}.svg`, `${fileName}.css`);
   const spriteFolder = zip.folder(`${fps}fps`);
   spriteFolder.file(`${fileName}.html`, htmlSprite);
   spriteFolder.file(`${fileName}.css`, cssSprite);
   spriteFolder.file(`${fileName}.svg`, svgSprite);
 });
开发者ID:arpitsaan,项目名称:ShapeShifter,代码行数:11,代码来源:fileexport.service.ts


示例7: create

export function create(callback: (blob: Blob) => any) {
  let zip = new JSZip();

  let mainfsfolder = zip.folder("mainfs");
  let mainfsDirCount = mainfs.getDirectoryCount();
  for (let d = 0; d < mainfsDirCount; d++) {
    let dirFolder = mainfsfolder.folder(d.toString());
    let dirFileCount = mainfs.getFileCount(d);
    for (let f = 0; f < dirFileCount; f++) {
      let file = mainfs.get(d, f);
      let name = f.toString();
      if (FORM.isForm(file))
        name += ".form";
      else if (MTNX.isMtnx(file))
        name += ".mtnx";
      dirFolder.file(name, file);
    }
  }

  zip.generateAsync({type: "blob"}).then(callback);
}
开发者ID:PartyPlanner64,项目名称:PartyPlanner64,代码行数:21,代码来源:dump.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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