@rpg-engine/shared 0.2.96 → 0.2.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
static createZipMap(mapName: string, mapObject: object, pathToSave: string): Promise<void>;
|
|
3
|
-
static readZip(fileName: any, filePath: any): Promise<object>;
|
|
4
|
-
}
|
|
5
|
-
export declare const mapZipHelper: MapZipHelper;
|
|
1
|
+
export declare const createZipMap: (mapName: string, mapObject: object, pathToSave: string) => Promise<void>;
|
|
6
2
|
//# sourceMappingURL=MapZipHelper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapZipHelper.d.ts","sourceRoot":"","sources":["../../src/libs/MapZipHelper.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"MapZipHelper.d.ts","sourceRoot":"","sources":["../../src/libs/MapZipHelper.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,YAAmB,MAAM,aAAa,MAAM,cAAc,MAAM,KAAG,QAAQ,IAAI,CAMvG,CAAC"}
|
|
@@ -9,32 +9,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const { compress
|
|
12
|
+
exports.createZipMap = void 0;
|
|
13
|
+
const { compress } = require("compress-json");
|
|
14
14
|
const fs = require("fs");
|
|
15
15
|
const JSZip = require("jszip");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
static readZip(fileName, filePath) {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const data = yield fs.readFileSync(filePath);
|
|
29
|
-
const zipRead = new JSZip();
|
|
30
|
-
const content = yield zipRead.loadAsync(data);
|
|
31
|
-
const fileBuffer = yield content.file(`${fileName}.txt`).async("uint8array");
|
|
32
|
-
const bufferedString = Buffer.from(fileBuffer.buffer).toString();
|
|
33
|
-
const fileContent = decompress(JSON.parse(bufferedString));
|
|
34
|
-
return fileContent;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.MapZipHelper = MapZipHelper;
|
|
39
|
-
exports.mapZipHelper = new MapZipHelper();
|
|
16
|
+
const createZipMap = (mapName, mapObject, pathToSave) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const data = compress(mapObject);
|
|
18
|
+
const zip = new JSZip();
|
|
19
|
+
zip.file(`${mapName}.txt`, JSON.stringify(data));
|
|
20
|
+
const buffer = yield zip.generateAsync({ type: "uint8array" });
|
|
21
|
+
yield fs.createWriteStream(`${pathToSave}/${mapName}.zip`).write(buffer);
|
|
22
|
+
});
|
|
23
|
+
exports.createZipMap = createZipMap;
|
|
40
24
|
//# sourceMappingURL=MapZipHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapZipHelper.js","sourceRoot":"","sources":["../../src/libs/MapZipHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"MapZipHelper.js","sourceRoot":"","sources":["../../src/libs/MapZipHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC9C,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAExB,MAAM,YAAY,GAAG,CAAO,OAAe,EAAE,SAAiB,EAAE,UAAkB,EAAiB,EAAE;IAC1G,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;IACxB,GAAG,CAAC,IAAI,CAAC,GAAG,OAAO,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;IAC/D,MAAM,EAAE,CAAC,iBAAiB,CAAC,GAAG,UAAU,IAAI,OAAO,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC3E,CAAC,CAAA,CAAC;AANW,QAAA,YAAY,gBAMvB"}
|