zeck 2.1.1 → 2.1.3

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 (3) hide show
  1. package/README.md +27 -39
  2. package/package.json +1 -1
  3. package/zeck_bg.wasm +0 -0
package/README.md CHANGED
@@ -315,7 +315,7 @@ After installation, you can use `zeck-compress` and `zeck-decompress` directly f
315
315
 
316
316
  #### zeck-compress
317
317
 
318
- Compresses data using the Zeckendorf representation algorithm. Automatically adds `.zbe` extension for big-endian compression and `.zle` extension for little-endian compression.
318
+ Compresses data using the Zeckendorf representation algorithm. Automatically adds `.zeck` extension for compressed files.
319
319
 
320
320
  ```bash
321
321
  zeck-compress [INPUT] [-o OUTPUT] [--endian ENDIAN] [-v]
@@ -325,13 +325,13 @@ zeck-compress [INPUT] [-o OUTPUT] [--endian ENDIAN] [-v]
325
325
  - `INPUT`: Input file path (optional, reads from stdin if not specified)
326
326
  - Shows a warning if reading from stdin and no data was piped in
327
327
  - `-o, --output FILE`: Output file path (optional)
328
- - If not specified and input is a file, uses the input filename with the appropriate extension (`.zbe` or `.zle`) appended
328
+ - If not specified and input is a file, uses the input filename with the `.zeck` extension appended
329
329
  - If not specified and reading from stdin, writes to stdout
330
- - The appropriate extension (`.zbe` for big-endian, `.zle` for little-endian) is automatically added unless the file already ends with `.zbe` or `.zle`
330
+ - The `.zeck` extension is automatically added unless the file already ends with `.zeck`
331
331
  - `--endian ENDIAN`: Endianness to use (`big`, `little`, or `best`). Default: `best`
332
- - `big`: Use big-endian interpretation (output will have `.zbe` extension)
333
- - `little`: Use little-endian interpretation (output will have `.zle` extension)
334
- - `best`: Try both and use the best result (default, extension added based on which was used)
332
+ - `big`: Use big-endian interpretation
333
+ - `little`: Use little-endian interpretation
334
+ - `best`: Try both and use the best result (default)
335
335
  - **Note:** When using `best`, if neither method produces compression (both result in larger or equal output), the tool will exit with an error showing compression statistics
336
336
  - `-v, --verbose`: Show compression statistics (default: true, use `--no-verbose` to disable)
337
337
 
@@ -339,74 +339,61 @@ zeck-compress [INPUT] [-o OUTPUT] [--endian ENDIAN] [-v]
339
339
  ```bash
340
340
  # Compress a file (output filename automatically created from input with extension)
341
341
  zeck-compress input.bin
342
- # Creates input.bin.zbe or input.bin.zle depending on which endianness was used
342
+ # Creates input.bin.zeck
343
343
 
344
344
  # Compress with best endianness (statistics shown by default)
345
345
  zeck-compress input.bin --endian best
346
346
 
347
- # Compress with specific endianness (creates input.bin.zbe)
347
+ # Compress with specific endianness
348
348
  zeck-compress input.bin --endian big
349
349
 
350
350
  # Compress to a specific output file
351
351
  zeck-compress input.bin -o output
352
- # Creates output.zbe or output.zle depending on which endianness was used
352
+ # Creates output.zeck
353
353
 
354
354
  # Compress from stdin to stdout
355
355
  cat input.bin | zeck-compress
356
356
  ```
357
357
 
358
- **Note:** When writing to a file, the output filename is printed to stdout (e.g., "Compressed to: input.bin.zbe"). Verbose statistics are shown by default and include descriptive messages about compression ratios (e.g., "File was compressed by X.XX% (Y bytes -> Z bytes)"). A warning is shown when reading from stdin if no data was piped in.
358
+ **Note:** When writing to a file, the output filename is printed to stdout (e.g., "Compressed to: input.bin.zeck"). Verbose statistics are shown by default and include descriptive messages about compression ratios (e.g., "File was compressed by X.XX% (Y bytes -> Z bytes)"). A warning is shown when reading from stdin if no data was piped in.
359
359
 
360
360
  #### zeck-decompress
361
361
 
362
- Decompresses data that was compressed using the Zeckendorf representation algorithm. Automatically detects endianness from file extension (`.zbe` for big-endian, `.zle` for little-endian).
362
+ Decompresses data that was compressed using the Zeckendorf representation algorithm. Automatically detects endianness from the file header.
363
363
 
364
364
  ```bash
365
- zeck-decompress [INPUT] [-o OUTPUT] [--endian ENDIAN] [-v]
365
+ zeck-decompress [INPUT] [-o OUTPUT] [-v]
366
366
  ```
367
367
 
368
368
  **Options:**
369
369
  - `INPUT`: Input file path (optional, reads from stdin if not specified)
370
- - When reading from a file, endianness is automatically detected from file extension (`.zbe` for big-endian, `.zle` for little-endian)
371
- - **If extension is not recognized, `--endian` is REQUIRED** (exits with error if not specified)
372
- - **When reading from stdin, `--endian` is REQUIRED**
370
+ - When reading from a file, endianness is automatically detected from the file header
371
+ - When reading from stdin, endianness is automatically detected from the file header
373
372
  - Shows a warning if reading from stdin and no data was piped in
374
373
  - `-o, --output FILE`: Output file path (optional)
375
- - If not specified and input is a file, uses the input filename with `.zbe` or `.zle` extension removed
374
+ - If not specified and input is a file, uses the input filename with `.zeck` extension removed
376
375
  - If not specified and reading from stdin, writes to stdout
377
- - `--endian ENDIAN`: Endianness used during compression (`big` or `little`)
378
- - `big`: Decompress as big-endian
379
- - `little`: Decompress as little-endian
380
- - **REQUIRED when reading from stdin** (no input file specified)
381
- - When reading from a file, this option overrides automatic detection from file extension
382
376
  - `-v, --verbose`: Show decompression statistics (default: true, use `--no-verbose` to disable)
383
377
 
384
378
  **Examples:**
385
379
  ```bash
386
- # Decompress a file (endianness detected from .zbe extension, output filename automatically created)
387
- zeck-decompress input.zbe
388
- # Automatically uses big-endian decompression, creates output file "input"
389
-
390
- # Decompress with little-endian file
391
- zeck-decompress input.zle
392
- # Automatically uses little-endian decompression, creates output file "input"
380
+ # Decompress a file (endianness detected from file header, output filename automatically created)
381
+ zeck-decompress input.zeck
382
+ # Automatically detects endianness from header, creates output file "input"
393
383
 
394
384
  # Decompress to a specific output file
395
- zeck-decompress input.zbe -o output.bin
396
- # Automatically uses big-endian decompression
397
-
398
- # Override automatic detection
399
- zeck-decompress input.zbe --endian little -o output.bin
400
- # Overrides the .zbe extension and uses little-endian
385
+ zeck-decompress input.zeck -o output.bin
386
+ # Automatically detects endianness from header
401
387
 
402
- # Decompress from stdin to stdout (--endian is required)
403
- cat input.zbe | zeck-decompress --endian big
388
+ # Decompress from stdin to stdout
389
+ cat input.zeck | zeck-decompress
390
+ # Automatically detects endianness from header
404
391
  ```
405
392
 
406
- **Note:** The endianness used for decompression must match the endianness used during compression. The file extension (`.zbe` or `.zle`) indicates which endianness was used, so decompression will automatically use the correct endianness when reading from a file. **If the input file doesn't have a recognized extension, `--endian` must be explicitly specified** (the tool will exit with an error if not provided). You can override automatic detection with the `--endian` flag if needed. **When reading from stdin, `--endian` must be explicitly specified** since there's no file extension to detect from.
393
+ **Note:** The endianness used for decompression must match the endianness used during compression. The file header stores which endianness was used, so decompression will automatically use the correct endianness when reading from a file or from stdin.
407
394
 
408
395
  **Additional features:**
409
- - When writing to a file, the output filename is printed to stdout (e.g., "Compressed to: input.bin.zbe" or "Decompressed to: output.bin")
396
+ - When writing to a file, the output filename is printed to stdout (e.g., "Compressed to: input.bin.zeck" or "Decompressed to: output.bin")
410
397
  - Verbose statistics are shown by default (use `--no-verbose` to disable) and include descriptive messages about compression/decompression ratios
411
398
  - Compression will exit with an error if the data cannot be compressed (when using `--endian best` and neither method produces compression)
412
399
  - A warning is shown when reading from stdin if no data was piped in
@@ -540,7 +527,7 @@ This avoids redundant Fibonacci numbers (F(0)=0 and F(1)=F(2)=1).
540
527
 
541
528
  ## NPM Versioning Quirk
542
529
 
543
- For some reason, NPM was showing there were versions of zeck published between `1.0.0` and `1.0.6` from 2024, even though I never published them to npm. I don't know how this happened. So I bumped the version to `1.0.7` and was able to successfully publish it to npm. Maybe there was an old package with the same name that was deleted, and NPM is still showing the old versions.
530
+ For some reason, NPM was showing there were versions of zeck published between `1.0.0` and `1.0.6` from 2024 (we are in 2026), even though I never published them to npm. I don't know how this happened. So I bumped the version to `1.0.7` and was able to successfully publish it to npm. Maybe there was an old package with the same name that was deleted, and NPM is still showing the old versions.
544
531
 
545
532
  Here is a snippet of the `time` object from the npm registry JSON (https://registry.npmjs.org/zeck):
546
533
 
@@ -572,3 +559,4 @@ Contributions are welcome! Please feel free to submit a Pull Request. For major
572
559
 
573
560
  - [Fast Fibonacci Algorithms](https://www.nayuki.io/page/fast-fibonacci-algorithms) - Fast doubling algorithm reference
574
561
  - [Zeckendorf's Theorem](https://en.wikipedia.org/wiki/Zeckendorf%27s_theorem) - Every positive integer has a unique representation as a sum of non-consecutive Fibonacci numbers
562
+ - [Exploring Fibonacci Based Compression](https://medium.com/@peterryszkiewicz/exploring-fibonacci-based-compression-8713770f5598) - My blog post about the Zeckendorf representation algorithm and this library
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Peter Ryszkiewicz"
6
6
  ],
7
7
  "description": "A Rust library for compressing and decompressing data using the Zeckendorf representation algorithm",
8
- "version": "2.1.1",
8
+ "version": "2.1.3",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
package/zeck_bg.wasm CHANGED
Binary file