arj: Include the "reserved" field in the dbg output
[deark.git] / readme.md
blob0d45aef22ddb14f649ce51c3e78241ecce51e21c
1 # Deark #
3 Deark is a command-line utility that can decode certain types of files, and
4 either:
6 1. convert them to a more-modern or more-readable format; or
7 2. extract embedded files from them
9 The files it writes are usually named "output.*".
11 Features are subject to change without notice, as new versions are released.
13 Windows binaries are available at the
14 [main website](https://entropymine.com/deark/).
16 For additional information, see the [technical.md](technical.md) file.
18 ## Usage ##
20     deark [options] [-file] <input-file> [options]
21     deark <-h|-version|-modules>
23 Command-line options:
24 <pre>
25 -m &lt;module>
26    The "module" to use to process the input file. The default is to autodetect.
27    A module may represent one file format, or a group of related formats, or
28    may have some special purpose.
29    See formats.txt for a list of modules. You usually don't need to use -m,
30    unless the format can't be detected, or you want to use a special-purpose
31    module such as "copy". See also the -onlydetect option.
33    Don't extract, but list the files that would be extracted.
34    This option is not necessarily very efficient. Deark will still go through
35    all the motions of extracting the files, but will not actually write them.
36 -main
37    Extract only "primary" files (e.g. not thumbnail images).
38 -aux
39    Extract only "auxiliary" files, such as thumbnail images.
40 -a, -extractall
41    Extract more data than usual, including things that are rarely of interest,
42    such as comments. See also the "-opt extract..." options, and the format-
43    specific options in technical.md.
44    In a few contexts, -a has some other type of "do more" function.
45 -o &lt;name>
46    Output filenames begin with this string. This can include a directory
47    path. Default is "output", except in some cases when using -zip/-tar.
48 -t &lt;name>
49    Use exactly this filename for the first (and presumably only) output file.
50    The "-maxfiles 1" option is enabled automatically. Including the -main
51    option is suggested.
52 -k, -k2, -k3
53    "Keep" the input filename, and use it as the initial part of the output
54    filename(s). Incompatible with -o.
55    -k: Use only the base filename.
56    -k2: Use the full path, but not as an actual path.
57    -k3: Use the full path, as-is.
58 -od &lt;directory>
59    The directory in which to write output files. The directory must exist.
60    This affects only files that Deark writes directly, not e.g. the names of
61    ZIP member files when using -zip.
63    Do not overwrite existing output files.
64 -file &lt;input-file>
65    This is an alternate syntax for specifying the primary input file. It works
66    even if the filename begins with "-".
67 -file2 &lt;file>
68    Some formats are composed of more than one file. In some cases, you can
69    use the -file2 option to specify the secondary file. Refer to the
70    formats.txt file for details.
71 -zip
72    Write output files to a .zip file, instead of to individual files.
73    If the input format is an "archive" format (e.g. "ar" or "zoo"), then
74    by default, the filenames in the ZIP archive might not include the usual
75    "output.NNN" prefix.
76 -tar
77    Write output files to a .tar file, instead of to individual files.
78    Similar to -zip, but may work better with large files.
79    The -tostdout option is not currently supported when using -tar.
80 -ta &lt;filename> (alias: -arcfn)
81    When using -zip/-tar, use this name for the output file. Default is
82    "output.zip" or "output.tar".
83 -ka, -ka2, -ka3
84    When using -zip/-tar, "keep" the input filename, and use it as the initial
85    part of the archive output filename. A suitable filename extension like
86    ".zip" will be appended. Incompatible with -arcfn.
87    -ka: Use only the base filename.
88    -ka2: Use the full path, but not as an actual path.
89    -ka3: Use the full path, as-is.
90 -extrlist &lt;filename>
91    Also create a text file containing a list of the names of the extracted
92    files. Format is UTF-8, no BOM, LF terminators. To append to the file
93    instead of overwriting, use with "-opt extrlist:append".
94 -tostdout
95    Write the output file(s) to the standard output stream (stdout).
96    It is recommended to put -tostdout early on the command line. The
97    -msgstostderr option is enabled automatically.
98    If used with -zip: Write the ZIP file to standard output.
99    Otherwise: The "-maxfiles 1" option is enabled automatically. Including the
100    -main option is recommended.
101 -fromstdin
102    Read the input file from the standard input stream (stdin).
103    If you use -fromstdin, supplying an input filename is optional. If it is
104    supplied, the file will not be read (and need not exist), but the name
105    might be used to help guess the file format.
106    This option might not be very efficient, and might not work with extremely
107    large files.
108 -start &lt;n>
109    Pretend that the input file starts at byte offset &lt;n>.
110    As a special case, for EXE files, use "-start overlay" to process only the
111    "overlay" segment. This can be used to handle the executable form of a
112    number of DOS formats, such as some self-extracting archives.
113 -size &lt;n>
114    Pretend that the input file contains only (up to) &lt;n> bytes.
115 -firstfile &lt;n>
116    Don't extract the first &lt;n> files found.
117 -maxfiles &lt;n>
118    Extract at most &lt;n> files. The normal default is 1000, or effectively
119    unlimited if using -zip.
120 -get &lt;n>
121    Extract only the file identified by &lt;n>. The first file is 0.
122    Equivalent to "-firstfile &lt;n> -maxfiles 1".
123    To unconditionally show the file identifiers, use "-l -opt list:fileid".
124 -maxfilesize &lt;n>
125    Do not write a file larger than &lt;n> bytes. The default is 10 GiB.
126    This is an "emergency brake". If the limit is exceeded, Deark will stop all
127    processing.
128    This setting is for physical output files, so if you use -zip/-tar, it
129    applies to the ZIP/tar file, not to the individual member files.
130    This option implicitly increases the -maxtotalsize setting to be at least
131    &lt;n>.
132 -maxtotalsize &lt;n>
133    Do not write files totaling more than about &lt;n> bytes. The default is
134    15 GiB.
135    Currently, this feature is not implemented very precisely. The limit is only
136    checked when an output file is completed.
137 -maxdim &lt;n>
138    Allow image dimensions up to &lt;n> pixels.
139    By default, Deark refuses to generate images with a dimension larger than
140    10000 pixels. You can use -maxdim to decrease or increase the limit.
141    Increase the limit at your own risk. Deark does not generate large images
142    efficiently. In practice, a large dimension will only work if the other
143    dimension is very small.
144 -padpix
145    Include "padding" pixels/bits in the image output.
146    Some images have extra bits at the end of each row that are used for
147    alignment, and are not normally made visible.
148    This option is not implemented for all formats.
149 -nobom
150    Do not add a BOM to UTF-8 output files generated or converted by Deark. Note
151    that if a BOM already exists in the source data, it will not necessarily be
152    removed.
153 -nodens
154    Do not try to record the original aspect ratio and pixel density in output
155    image files.
156 -asciihtml
157    When generating an HTML document, use ASCII encoding instead of UTF-8. This
158    does not change how a browser will render the file; it just makes it larger
159    and very slightly more portable.
160 -nonames
161    Make Deark less likely to try to improve output filenames by using names
162    from the contents of the input file. The output filenames will be more
163    predictable, but less informative.
164 -nomodtime
165    In some cases, mainly when reading archive formats, a last-modified
166    timestamp contained in an input file will be used to set the timestamp of an
167    output file written directly to your computer (or with -zip/-tar, of a
168    member file inside that file). Use -nomodtime to disable this.
169    This does not affect internal timestamps that may be maintained when Deark
170    converts an item to some other format (such as PNG or HTML).
171 -opt &lt;module:option>=&lt;value>
172    Module-specific and feature-specific options. See formats.txt.
173    Caution: Unrecognized or misspelled options will be silently ignored.
174    Options not specific to one format:
175     -opt font:charsperrow=&lt;n>
176        The number of characters per row, when rendering a font to a bitmap
177     -opt font:tounicode=&lt;0|1>
178        [Don't] Try to translate a font's codepoints to Unicode codepoints.
179     -opt char:output=&lt;html|image>
180        The output format for character graphics (such as ANSI Art).
181     -opt char:charwidth=&lt;8|9>
182        The VGA character cell width for character graphics, when the output
183        format is "image".
184     -opt archive:subdirs=0
185        When using -zip/-tar, disallow subdirectories (the "/" character) in
186        member filenames.
187     -opt archive:zipcmprlevel=&lt;n>
188        When using -zip, the compression level to use, from 0 (none) to 9 (max).
189     -opt pngcmprlevel=&lt;n>
190        When generating a PNG file, the compression level to use, from 0 (low)
191        to 10 (max).
192     -opt archive:timestamp=&lt;n>
193     -opt archive:repro
194        Make the -zip/-tar output reproducible, by not including modification
195        times that are not contained in the source file. (That is, don't use the
196        current time, or the source file's timestamp.) If you use "repro", the
197        times will be set to some arbitrary value. If you use "timestamp", the
198        times will be set to the value you supply, in Unix time format (the
199        number of seconds since the beginning of 1970).
200     -opt keepdirentries=&lt;0|1>
201        Select whether an archive file's directory entries are ignored (0), or
202        "extracted" (1). For details, see the technical.md file.
203     -opt list:fileid=&lt;0|1>
204        Select whether the -l (list) option also prints the numeric file
205        identifiers.
206     -opt extrlist:append
207        Affects the -extrlist option.
208     -opt extractexif[=0]
209     -opt extract8bim
210     -opt extractiptc[=0]
211     -opt extractplist
212        Extract the specified type of data to a file, instead of decoding it.
213        For more about the ".8bimtiff" and ".iptctiff" formats, see the
214        technical.md file.
215     -opt execomp
216        A hint to decompress files that use executable compression, when there
217        are multiple ways to process the file. This is not as robust as using -m
218        to select the appropriate module.
219     -opt atari:palbits=&lt;9|12|15>
220        For some Atari image formats, the number of significant bits per
221        palette color. The default is to autodetect.
222     -opt macrsrc=&lt;raw|as|ad|mbin>
223        The preferred way to extract Macintosh resource forks, and data files
224        associated with a non-empty resource fork.
225         raw = Write the raw resource fork to a separate .rsrc file.
226         ad = Put the resource fork in an AppleDouble container (default).
227         as = Put both forks in an AppleSingle container.
228         mbin = Put both forks in a MacBinary container.
229        For input files already in AppleDouble or AppleSingle format, see the
230        formats.txt file for more information.
231     -opt macmeta
232        A hint to preserve Macintosh metadata (type/creator codes) even if there
233        is no resource fork. The format specified by the "macrsrc" option will
234        be used.
235     -opt riscos:appendtype
236        For RISC OS formats, append the file type to the output filename.
237     -opt deflatecodec=native
238        Use Deark's native "Deflate" decompressor when possible, instead of
239        miniz. It is experimental and much slower, but could be useful for
240        debugging and educational purposes.
242    Stop after the format identification phase. This can be used to show what
243    module Deark will run, without actually running it.
244 -h, -?, -help:
245    Print the help message.
246    Use with -m to get help for a specific module. Use with a filename to get
247    help for the detected format of that file. Note that most modules have no
248    module-specific help to speak of.
249 -version
250    Print the version number, and other version information.
251 -modules
252    Print the names of the available modules.
253    With -a, list all modules, including internal modules, and modules that
254    don't work.
255 -noinfo
256    Suppress informational messages.
257 -nowarn
258    Suppress warning messages.
260    Suppress informational and warning messages.
261 -d, -d2, -d3, -d4
262    Print technical information about the contents of the file. -d2 is more
263    verbose. -d3 are -d4 are mainly for debugging.
264 -dprefix &lt;msg>
265    Start each line printed by -d with this prefix. Default is "DEBUG: ".
266 -colormode &lt;none|auto|ansi|ansi24|winconsole>
267    Control whether Deark uses color and similar features in its debug output.
268    Currently, this is mainly used to highlight unprintable characters, and
269    preview color palettes (usually requires -d2).
270    none: No color (default).
271    ansi: Use ANSI codes, but not the less-standard ones for 24-bit color.
272    ansi24: Use ANSI codes, including codes for 24-bit color. Works on most
273      Linux terminals, and on sufficiently new versions of Windows 10.
274    winconsole: Use Windows console commands. Works on all versions of Windows,
275      but does not support 24-bit color.
276    auto: Request color. Let Deark decide how to do it.
277 -color
278    Same as "-colormode auto".
279 -enc &lt;ascii|oem>
280    Set the encoding of the messages that are printed to the console. This does
281    not affect the extracted data files.
282    The default is to use Unicode (UTF-8, when the encoding is relevant).
283    ascii: Use ASCII characters only.
284    oem: [Windows only; has no effect on other platforms] Use the "OEM"
285      character set. This may be useful when paging the output with "|more".
286 -nochcp
287    [Windows only] Never change the console OEM code page (to UTF-8).
288    For technical reasons, Deark sometimes changes the code page of the Windows
289    console it is running in, when its output is going to a pipe or file.
290 -inenc &lt;ascii|utf8|latin1|latin2|cp437|cp932|windows874|windows1250|
291      windows1251|windows1252|windows1253|windows1254|macroman|palm|riscos|
292      atarist>
293    Supply a hint as to the encoding of the text contained in the input file.
294    This option is not supported by all formats, and may be ignored if the
295    encoding can be reliably determined by other means. Admittedly, it would be
296    nice if Deark knew more encodings than this.
297    The "cp932" (including Shift-JIS) encoding is experimental. There are many
298    variants of the encodings in this family, but only one is supported.
299 -intz &lt;offset>
300    Supply a hint as to the time zone used by timestamps contained in the input
301    file.
302    Many file formats unfortunately contain timestamps in "local time", with no
303    information about their time zone. In such cases, the supplied -intz offset
304    will be used to convert the timestamp to UTC.
305    The "offset" parameter is in hours east of UTC. For example, New York City
306    is -5.0, or -4.0 when Daylight Saving Time is in effect.
307    This option does not respect Daylight Saving Time. It cannot deal with the
308    case where some of the timestamps in a file are in DST, and others are not.
309 -msgstostderr
310    Print all messages to stderr, instead of stdout. This option should be
311    placed early on the command line, as it might not affect messages
312    related to options that appear before it.
313 -nodetect &lt;module1,module2,...>
314 -onlydetect &lt;module1,module2,...>
315    Disable autodetection of the formats in the list (or for -onlydetect, the
316    formats *not* in the list).
317 -disablemods &lt;module1,module2,...>
318 -onlymods &lt;module1,module2,...>
319    Completely disable the main functionality, and the autodetection
320    functionality, of the modules in the list (or for -onlymods, the modules
321    *not* in the list). This can have unexpected side effects, because modules
322    often use other modules internally. These options exist mainly to help
323    address potential security-related concerns in some workflows.
324 -modcodes &lt;codes>
325    Run the module in a non-default "mode".
326    The existence of this option (though not its details) is documented in the
327    interest of transparency, but it is mainly for developers, and to make it
328    possible to do things whose usefulness was not anticipated.
329 </pre>
331 ## Exit status ##
333 Deark sets the exit status to nonzero only if it wasn't able to do its job,
334 e.g. due to a read or write failure. A malformed input file usually does not
335 cause such an error, and the exit status will be zero even if an error message
336 was printed.
338 However, all fatal errors result in a nonzero exit status, and in extreme cases
339 it is possible for the input file to cause a fatal error, due to certain
340 resource limits being exceeded.
342 ## Terms of use ##
344 Starting with version 1.4.x, Deark is distributed under an MIT-style license.
345 See the [COPYING](COPYING) file for the license text.
347 The main Deark license does not necessarily apply to the code in the "foreign"
348 subdirectory. Each file there may have its own licensing terms. In particular:
350 miniz*.h: MIT-style license, various authors. See the *miniz* files for
351 details.
353 uncompface.h: Copyright (c) James Ashton - Sydney University - June 1990. See
354 readme-compface.txt for details.
356 lzhuf.h: Based on lzhuf.c by Haruyasu Yoshizaki. See readme-lzhuf.txt for
357 details.
359 By necessity, Deark contains knowledge about how to decode various
360 third-party file formats. This knowledge includes data structures,
361 algorithms, tables, color palettes, etc. The author(s) of Deark make no
362 intellectual property claims to this essential knowledge, but they cannot
363 guarantee that no one else will attempt to do so.
365 Deark contains VGA and CGA bitmapped fonts, which have no known copyright
366 claims.
368 Be particularly wary of relying on Deark to decode archive and compression
369 formats (tar, ar, gzip, cpio, ...). For example, to decode tar format, you
370 really should use a battle-hardened application like GNU Tar, not Deark.
371 Deark's support for such formats is often incomplete, and it does not always
372 do integrity checking.
374 ## Feedback and contributions ##
376 (As of 2020-09.) Suggestions and bug reports are welcome. This can be done by
377 opening a GitHub issue, or by email. If you prefer to do it in the form of a
378 GitHub "pull request", that's fine too, but as a general rule, such requests
379 won't be merged directly.
381 Deark is not really a collaborative project at this time. Unsolicited
382 contributions of more than a few lines of code are unlikely to be accepted.
383 It's okay to offer them, but please don't do a lot of work with the
384 expectation that it will be accepted.
386 Any code copyrighted by someone other than the main Deark developer(s) is only
387 allowed in the "foreign" section of the project. Pointers to existing open
388 source format decoders, that might be useful in Deark, are welcome. However,
389 most such code will be rejected for one reason or another (incompatible
390 license, too large, too trivial, etc.).
392 ## How to build ##
394 See the [technical.md](technical.md) file.
396 ## Acknowledgements ##
398 Thanks to Rich Geldreich and others for the miniz library.
400 Thanks to the author of dskdcmps for the code used to decompress OS/2 PACK and
401 LoadDskF files.
403 Thanks to James Ashton for much of the code used by the X-Face format decoder.
405 Thanks to Haruyasu Yoshizaki and Haruhiko Okumura for the lzhuf.c decompressor.
407 Thanks to countless others who have documented the supported file formats.
409 ## Authors ##
411 Written by Jason Summers, 2014-2025.<br>
412 Copyright &copy; 2016-2025 Jason Summers<br>
413 [https://entropymine.com/deark/](https://entropymine.com/deark/)<br>
414 [https://github.com/jsummers/deark](https://github.com/jsummers/deark)<br>
415 [https://github.com/jsummers/deark-extras](https://github.com/jsummers/deark-extras)