Deark demonstration

Note: Deark is not intended for mission-critical uses. It’s there if you need it, but despite this demo, you really shouldn’t use it to deal with difficult formats like tar or gzip, when a better option is available.

Plug: Deark is self-contained. It’s not a script or a shell that just runs other programs.

This demo assumes you’re using a Unix-like shell. From a Windows command prompt, you can still run the “deark” commands, but the other commands probably won’t work.

We’ll make a scratch directory, and download an old and possibly-interesting file that I found on the internet. (If this link is broken, do a web search for “fbm-1.2.tgz”.)

$ mkdir dtest
$ cd dtest
~/dtest $ wget ''

What sort of file is it? Let’s ask the “file” utility:

~/dtest $ file fbm-1.2.tgz
fbm-1.2.tgz: gzip compressed data ...

It’s a gzipped file. We could use GNU gzip, or another gzip decoder. But we could also use Deark:

~/dtest $ deark fbm-1.2.tgz
Module: gzip
Writing output.000.fbm1.2.tar

We’ve extracted a file that Deark has named “output.000.fbm1.2.tar”. (It’s a bit odd that the “-” symbol in “fbm-1.2” has disappeared, but Deark did not remove it. For unknown reasons, the internal name of the file does not include the “-” symbol.)

What kind of file is it?

~/dtest $ file output.000.fbm1.2.tar
output.000.fbm1.2.tar: tar archive

No surprise; it’s a “tar” archive.

By the way, we could also ask Deark what kind of file it thinks it is:

~/dtest $ deark -id output.000.fbm1.2.tar
Module: tar

But the “file” utility is much, much better at this sort of thing.

To deal with the tar archive, we could use GNU tar, or another tar extractor. But we could also use Deark.

First, let’s see what’s in the file. I expect that it might contain lots of files, so I’ll use the -l option, and the “head” utility, to list only the first few files.

~/dtest $ deark output.000.fbm1.2.tar -l | head
Module: tar

If you really wanted to extract all the files from the tar file, you probably wouldn’t just use Deark, because of the way it prepends things like "output.000" to the file names. If you didn’t have a tar utility, but you did have an Unzip utility, one thing you could do is use Deark’s -zip option. That will cause it to write all the files to a Zip file, and when possible it will use the original filenames. But in this demo, we’re just going to extract one file, so we we’re not going to do that.

That “005” file looks interesting. Let’s extract it.

~/dtest $ deark output.000.fbm1.2.tar -get 5
Module: tar
Writing output.005.test.clr.Z.uu

What kind of file is it?

~/dtest $ file output.005.test.clr.Z.uu
output.005.test.clr.Z.uu: uuencoded or xxencoded, ASCII text

We could go find a uuencode/xxencode utility. Or we could see what Deark thinks of it:

~/dtest $ deark output.005.test.clr.Z.uu
Module: uuencode
Format: Uuencoded
Writing output.000.test.clr.Z

And now what do we have?

~/dtest $ file output.000.test.clr.Z
output.000.test.clr.Z: compress'd data 16 bits

It’s a “compress'd” file. Whatever that is. What are we going to do now?

(Right. We have to go deeper.)

Here’s an idea. We could use Deark:

~/dtest $ deark output.000.test.clr.Z
Module: compress
Writing output.000.bin

I admit, this is an annoyance. We can see that the original filename was “test.clr”. But Deark doesn’t know that. It really only cares about the contents of files, not their names, and “test.clr” was not in the contents of the “output.000.test.clr.Z” file. (Primitive file formats are primitive.)

Deark’s -k option might be better than nothing, but it isn’t smart enough to delete the “.Z”, so the resulting filename would be “output.000.test.clr.Z.bin”. Maybe a future version of Deark will have a way to better deal with this. But for now, for clarity, let’s just manually rename it:

~/dtest $ mv output.000.bin test.clr

What kind of a file is test.clr?

~/dtest $ file test.clr
test.clr: Sun raster image data, 320 x 420, 8-bit, RGB colormap

It’s a “Sun raster image” file. Okay.

If you know something about image formats or web searching, you might be able to figure out that we can now use the “rasttopnm” and “pamtopng” utilities from the Netpbm software. But there is another option. We could use Deark. This time, just as an example, let’s also use the -d option, to print detailed information about the file.

~/dtest $ deark -d test.clr
DEBUG: Input file: test.clr
Module: sunras
DEBUG: header at 0
DEBUG:  dimensions: 320×420
DEBUG:  depth: 8
DEBUG:  image type=1 (standard), len=134400
DEBUG:  map type=1 (EQUAL_RGB), len=768
DEBUG: colormap at 32
DEBUG: image data at 800
Writing output.000.png

Finally, Deark has converted the file to a mainstream format that almost anything can deal with: PNG.

test.clr (as output.000.png)

[Back to main Deark page]