@autobe/filesystem 0.18.0 → 0.19.1

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.
@@ -0,0 +1,4 @@
1
+ export declare namespace CompressUtil {
2
+ const gzip: (value: string) => Promise<Buffer>;
3
+ const gunzip: (buffer: Buffer) => Promise<string>;
4
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.CompressUtil = void 0;
16
+ const util_1 = require("util");
17
+ const zlib_1 = __importDefault(require("zlib"));
18
+ var CompressUtil;
19
+ (function (CompressUtil) {
20
+ CompressUtil.gzip = (value) => __awaiter(this, void 0, void 0, function* () {
21
+ const input = Buffer.from(value);
22
+ return (0, util_1.promisify)(zlib_1.default.gzip)(input, {
23
+ level: 9,
24
+ // windowBits: 15,
25
+ // memLevel: 9,
26
+ // strategy: zlib.constants.Z_DEFAULT_STRATEGY,
27
+ // chunkSize: 64 * 1_024,
28
+ });
29
+ });
30
+ CompressUtil.gunzip = (buffer) => __awaiter(this, void 0, void 0, function* () {
31
+ const result = yield (0, util_1.promisify)(zlib_1.default.gunzip)(buffer);
32
+ return result.toString("utf8");
33
+ });
34
+ })(CompressUtil || (exports.CompressUtil = CompressUtil = {}));
35
+ //# sourceMappingURL=CompressUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompressUtil.js","sourceRoot":"","sources":["../src/CompressUtil.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,gDAAwB;AAExB,IAAiB,YAAY,CAgB5B;AAhBD,WAAiB,YAAY;IACd,iBAAI,GAAG,CAAO,KAAa,EAAmB,EAAE;QAC3D,MAAM,KAAK,GAAW,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,OAAO,IAAA,gBAAS,EAAC,cAAI,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE;YACjC,KAAK,EAAE,CAAC;YACR,kBAAkB;YAClB,eAAe;YACf,+CAA+C;YAC/C,yBAAyB;SAC1B,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;IAEW,mBAAM,GAAG,CAAO,MAAc,EAAmB,EAAE;QAC9D,MAAM,MAAM,GAAW,MAAM,IAAA,gBAAS,EAAC,cAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;QAC5D,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC;AACJ,CAAC,EAhBgB,YAAY,4BAAZ,YAAY,QAgB5B"}
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./FileSystemIterator";
2
+ export * from "./CompressUtil";
2
3
  export * from "./RepositoryFileSystem";
package/lib/index.js CHANGED
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./FileSystemIterator"), exports);
18
+ __exportStar(require("./CompressUtil"), exports);
18
19
  __exportStar(require("./RepositoryFileSystem"), exports);
19
20
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,yDAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,iDAA+B;AAC/B,yDAAuC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobe/filesystem",
3
- "version": "0.18.0",
3
+ "version": "0.19.1",
4
4
  "description": "AI backend server code generator",
5
5
  "main": "lib/index.js",
6
6
  "author": "Wrtn Technologies",
@@ -0,0 +1,20 @@
1
+ import { promisify } from "util";
2
+ import zlib from "zlib";
3
+
4
+ export namespace CompressUtil {
5
+ export const gzip = async (value: string): Promise<Buffer> => {
6
+ const input: Buffer = Buffer.from(value);
7
+ return promisify(zlib.gzip)(input, {
8
+ level: 9,
9
+ // windowBits: 15,
10
+ // memLevel: 9,
11
+ // strategy: zlib.constants.Z_DEFAULT_STRATEGY,
12
+ // chunkSize: 64 * 1_024,
13
+ });
14
+ };
15
+
16
+ export const gunzip = async (buffer: Buffer): Promise<string> => {
17
+ const result: Buffer = await promisify(zlib.gunzip)(buffer);
18
+ return result.toString("utf8");
19
+ };
20
+ }
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./FileSystemIterator";
2
+ export * from "./CompressUtil";
2
3
  export * from "./RepositoryFileSystem";