@rpg-engine/shared 0.2.97 → 0.2.101
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.
- package/dist/libs/MapZipHelper.d.ts +1 -5
- package/dist/libs/MapZipHelper.d.ts.map +1 -1
- package/dist/libs/MapZipHelper.js +10 -32
- package/dist/libs/MapZipHelper.js.map +1 -1
- package/dist/types/maps.types.d.ts +1 -0
- package/dist/types/maps.types.d.ts.map +1 -1
- package/dist/types/maps.types.js.map +1 -1
- package/package.json +2 -4
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
static createZipMap(mapName: string, mapObject: object, pathToSave: string): Promise<void>;
|
|
3
|
-
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":"
|
|
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,38 +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
|
|
14
|
-
const fetch = require("node-fetch");
|
|
15
|
-
const File = require("file-class");
|
|
12
|
+
exports.createZipMap = void 0;
|
|
13
|
+
const { compress } = require("compress-json");
|
|
16
14
|
const fs = require("fs");
|
|
17
15
|
const JSZip = require("jszip");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
readZip(fileName, filePath) {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const data = yield (yield fetch(filePath)).blob();
|
|
31
|
-
const file = new File([data], fileName, { type: "application/zip" });
|
|
32
|
-
const zipRead = new JSZip();
|
|
33
|
-
const content = yield zipRead.loadAsync(file);
|
|
34
|
-
if (content.files && content.files[`${fileName}.txt`]) {
|
|
35
|
-
const txtFile = content.files[`${fileName}.txt`]._data.compressedContent;
|
|
36
|
-
const bufferedString = Buffer.from(txtFile).toString();
|
|
37
|
-
const fileContent = decompress(JSON.parse(bufferedString));
|
|
38
|
-
return fileContent;
|
|
39
|
-
}
|
|
40
|
-
return {};
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.MapZipHelper = MapZipHelper;
|
|
45
|
-
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;
|
|
46
24
|
//# sourceMappingURL=MapZipHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapZipHelper.js","sourceRoot":"","sources":["../../src/libs/MapZipHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAM,EAAE,QAAQ,EAAE,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maps.types.d.ts","sourceRoot":"","sources":["../../src/types/maps.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,oBAAY,SAAS;IACnB,MAAM,IAAI;IACV,UAAU,IAAI;IACd,SAAS,IAAI;IACb,aAAa,IAAI;CAClB"}
|
|
1
|
+
{"version":3,"file":"maps.types.d.ts","sourceRoot":"","sources":["../../src/types/maps.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,oBAAY,SAAS;IACnB,MAAM,IAAI;IACV,UAAU,IAAI;IACd,SAAS,IAAI;IACb,aAAa,IAAI;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maps.types.js","sourceRoot":"","sources":["../../src/types/maps.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"maps.types.js","sourceRoot":"","sources":["../../src/types/maps.types.ts"],"names":[],"mappings":";;;AAYA,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,6CAAU,CAAA;IACV,qDAAc,CAAA;IACd,mDAAa,CAAA;IACb,2DAAiB,CAAA;AACnB,CAAC,EALW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAKpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/shared",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.101",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Joao Paulo Furtado <joaopaulofurtado@live.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -38,8 +38,6 @@
|
|
|
38
38
|
"@rpg-engine/shared": "^0.2.51",
|
|
39
39
|
"@types/mongoose": "^5.11.97",
|
|
40
40
|
"compress-json": "^2.0.1",
|
|
41
|
-
"
|
|
42
|
-
"jszip": "^3.10.0",
|
|
43
|
-
"node-fetch": "^3.2.5"
|
|
41
|
+
"jszip": "^3.10.0"
|
|
44
42
|
}
|
|
45
43
|
}
|