stegdoc 5.1.0 → 5.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stegdoc",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "description": "Hide files inside Office documents (XLSX/DOCX) with AES-256 encryption and steganography",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -11,7 +11,7 @@ const verifyCommand = require('./commands/verify');
11
11
  program
12
12
  .name('stegdoc')
13
13
  .description('CLI tool to encode files into Office documents with AES-256 encryption')
14
- .version('5.0.0');
14
+ .version('5.2.0');
15
15
 
16
16
  // Encode command
17
17
  program
@@ -3,15 +3,24 @@ const zlib = require('zlib');
3
3
  // ─── Brotli Compression (v5+) ──────────────────────────────────────────────
4
4
 
5
5
  /**
6
- * Compress data using Brotli (best compression, used in v5+)
6
+ * Default Brotli quality level.
7
+ * Quality 6 offers ~10x faster compression than max (11) with only
8
+ * marginally larger output — a good trade-off for large files.
9
+ */
10
+ const BROTLI_DEFAULT_QUALITY = 6;
11
+
12
+ /**
13
+ * Compress data using Brotli (used in v5+)
7
14
  * @param {Buffer} buffer - Data to compress
15
+ * @param {number} [quality] - Compression quality (0-11, default 6)
8
16
  * @returns {Promise<Buffer>} Compressed data
9
17
  */
10
- function compressBrotli(buffer) {
18
+ function compressBrotli(buffer, quality) {
19
+ const q = quality !== undefined ? quality : BROTLI_DEFAULT_QUALITY;
11
20
  return new Promise((resolve, reject) => {
12
21
  zlib.brotliCompress(buffer, {
13
22
  params: {
14
- [zlib.constants.BROTLI_PARAM_QUALITY]: zlib.constants.BROTLI_MAX_QUALITY,
23
+ [zlib.constants.BROTLI_PARAM_QUALITY]: q,
15
24
  },
16
25
  }, (err, result) => {
17
26
  if (err) reject(err);
@@ -36,11 +45,11 @@ function decompressBrotli(buffer) {
36
45
 
37
46
  /**
38
47
  * Create a streaming Brotli compression transform
39
- * @param {number} [quality] - Compression quality (0-11, default 11)
48
+ * @param {number} [quality] - Compression quality (0-11, default 6)
40
49
  * @returns {zlib.BrotliCompress} Brotli transform stream
41
50
  */
42
51
  function createBrotliCompressStream(quality) {
43
- const q = quality !== undefined ? quality : zlib.constants.BROTLI_MAX_QUALITY;
52
+ const q = quality !== undefined ? quality : BROTLI_DEFAULT_QUALITY;
44
53
  return zlib.createBrotliCompress({
45
54
  params: {
46
55
  [zlib.constants.BROTLI_PARAM_QUALITY]: q,