Zip

Category: Compression

Status: Registered and callable in the CyberChef 11.3.0 compatibility inventory.

Input / output: ArrayBuffer → File

Background: https://wikipedia.org/wiki/Zip_(file_format)

What it does

Compresses data using the PKZIP algorithm with the given filename. No support for multiple files at this time.

Note

Status here means the operation name is implemented and callable. It does not by itself promise byte-for-byte parity for every upstream option. See Compatibility and current status for the verified scope and known boundaries.

Arguments and options

Arguments are positional. Keep their order when using bake() or Pipeline.then().

Index

Name

UI type

PyChef default

Accepted values / format

0

Filename

string

'file.txt'

'file.txt'

1

Comment

string

''

''

2

Password

binaryString

''

''

3

Compression method

option

'Deflate'

'Deflate', 'None (Store)'

4

Operating system

option

'MSDOS'

'MSDOS', 'Unix', 'Macintosh'

5

Compression type

option

'Dynamic Huffman Coding'

'Dynamic Huffman Coding', 'Fixed Huffman Coding', 'None (Store)'

Recipe template

Important

This is a call template built from the documented defaults. Replace placeholder values such as empty keys, paths, patterns, or lookup data before running it.

from pychef import bake

input_value = b"example"
args = ['file.txt', '', '', 'Deflate', 'MSDOS', 'Dynamic Huffman Coding']
result = bake(input_value, [{"op": 'Zip', "args": args}])
print(result)

Pipeline example

from pychef import Pipeline

args = ['file.txt', '', '', 'Deflate', 'MSDOS', 'Dynamic Huffman Coding']
transform = Pipeline().then('Zip', *args)
result = transform(b"example")

Dedicated operation module

The registered entry point lives in pychef.operations.by_operation.zip. Direct calls receive the input value and a positional argument tuple:

from pychef.operations.by_operation.zip import run

result = run(b"example", tuple(['file.txt', '', '', 'Deflate', 'MSDOS', 'Dynamic Huffman Coding']))
pychef.operations.by_operation.zip.run(value, args)

Run this operation using its shared internal implementation.

Parameters:
  • value (str | bytes)

  • args (Sequence[Any])

Return type:

str | bytes