UNPKG

1.96 kBSource Map (JSON)View Raw
1{"version":3,"file":"zipFactory.js","sourceRoot":"","sources":["../../../../../src/_utils/zip/zipFactory.ts"],"names":[],"mappings":";;;;AAOA,uBAAyB;AACzB,2BAA0B;AAE1B,6CAA0C;AAE1C,mCAAuC;AACvC,6CAAgD;AAChD,+BAA8B;AAC9B,+BAA8B;AAE9B,SAAsB,cAAc,CAAC,QAAgB;;;;YACjD,IAAI,IAAA,iBAAM,EAAC,QAAQ,CAAC,EAAE;gBACZ,GAAG,GAAG,IAAI,SAAG,CAAC,QAAQ,CAAC,CAAC;gBACxB,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC;gBACvB,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;oBACjB,WAAO,6BAAe,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAC;iBAChD;gBACD,WAAO,WAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAC;aACrC;YAEK,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACrC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE;gBACrB,WAAO,oBAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAC;aAC5C;YAED,WAAO,WAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAC;;;CACrC;AAhBD,wCAgBC","sourcesContent":["// ==LICENSE-BEGIN==\n// Copyright 2017 European Digital Reading Lab. All rights reserved.\n// Licensed to the Readium Foundation under one or more contributor license agreements.\n// Use of this source code is governed by a BSD-style license\n// that can be found in the LICENSE file exposed on Github (readium) in the project repository.\n// ==LICENSE-END==\n\nimport * as fs from \"fs\";\nimport { URL } from \"url\";\n\nimport { isHTTP } from \"../http/UrlUtils\";\nimport { IZip } from \"./zip\";\nimport { ZipExploded } from \"./zip-ex\";\nimport { ZipExplodedHTTP } from \"./zip-ex-http\";\nimport { Zip1 } from \"./zip1\";\nimport { Zip2 } from \"./zip2\";\n\nexport async function zipLoadPromise(filePath: string): Promise<IZip> {\n if (isHTTP(filePath)) {\n const url = new URL(filePath);\n const p = url.pathname;\n if (p.endsWith(\"/\")) { // bit hacky? :(\n return ZipExplodedHTTP.loadPromise(filePath);\n }\n return Zip2.loadPromise(filePath);\n }\n\n const stats = fs.lstatSync(filePath);\n if (stats.isDirectory()) {\n return ZipExploded.loadPromise(filePath);\n }\n\n return Zip1.loadPromise(filePath);\n}\n"]}
\No newline at end of file