Application Suite: Squash



Squash is an application which compresses files using the RISC OS Squash module. The Squash module compresses using a 12-bit LZW algorithm. As an alternative you can use the built in RISC OS Six ZIP module to produce GZIP compatible ZIP files.

  To use Squash simply double click on the !Squash application icon (shown left) in the Apps icon on the iconbar. This will install !Squash on the icon bar where the Squash icon will then appear.

Compressing a file

To compress a file simply drag it to the Squash icon on the icon bar. A Save as window will then appear. This will contain the original file name in the writable field.

To save the compressed file you can either:

  • Click on OK. This will compress the file and save it back to the location from which you dragged it, thereby replacing the original file with a compressed version having the same name.
  • Change the last part of the filename (the leaf name) and click on OK. This will save the compressed file to the same location as the original but with a different name so the original is left intact.
  • Drag the file icon in the Save as window to any open filer window, changing the file name first if you wish.

Decompressing a file

To decompress a file you can:

  • Double click on the compressed file. This will overwrite the compressed file with the decompressed file.
  • Drag the compressed file to the Squash icon on the icon bar. A Save as window will then open which allows the decompressed file to be saved elsewhere.

Compressing and decompressing files and directories

To compress or decompress a directory just drag the directory to the Squash icon on the icon bar. A window will then appear similar to the one shown below.

First make sure that the appropriate button Squash or Unsquash is selected. When this is done you can proceed as for compressing or decompressing a single file.

When compressing a directory (which can be an 'ordinary' directory or an application directory) Squash leaves the directory and file structure intact and compresses each individual file in the directory and any sub-directories within it.

The icon bar menu

Squash has one menu displayed by pressing MENU on the Squash icon on the icon bar.

The menu items are:

  • Info. This leads to a window which displays some information about the version of Squash that is running.
  • Save Box. If this is ticked (as it is by default) the Save as window will appear as described previously. Sometimes, for example, if a large selection is made and dragged to the squash icon, it may not be desirable to have a Save as window appear for every file or directory selected. This menu option can be used to turn off the Save as window which means that all files and directories will automatically be replaced by their compressed versions.
  • Squash Apps. This is used to enable the compressing of application directories which are inside directories which are to be compressed. by default this is off so application directories which are found as a sub_directory of another directory are not compressed. Application directories which are explicitly dragged to the Squash icon will always be compressed.
  • GZip. If this is ticked then Squash will produce GZIP files instead of Squash files. GZIP files will often be smaller than Squash files and have the advantage that they can normally be decompressed on other platforms. Squash is a proprietary Acorn file format used only on RISC OS systems, but it does have the advantage that it can be decompressed on any RISC OS computer system without any additional software.

Using Squash from the command line

The Squash module is present as part of the RISC OS operating system and can therefore be used either from the command line or by programs without the Squash application being loaded on the icon bar. The Squash application merely acts as a 'user friendly' desktop front end for the module.

The syntax of the command to compress or decompress a file is:

     Squash [-help] [-gzip] <from-file> [<to-file>]

With a single file name the compressed or decompressed version of the file replaces the original. Where a second file name is present the result is written to the second file name file. Note that directories cannot be compressed using this utility.

With both the Squash application and the command line utility, if an attempt is made to compress or decompress a zero length file or the result of a compression is larger than the original (this can happen for very small files) then the original file will simply be copied. If the original file was to be replaced by the output then the original file is left untouched.

Squash file format

Squash adds a header to the compressed data (when using the Squash format). This header is in the form:

           4-byte ID:       "SQSH"
           1-word:          length of the original, uncompressed file
           1-word:          load address of the original file
           1-word:          execution address of the original file
           1-word:          reserved (currently always 0)

The load and execution addresses are used to hold the file type and the date stamp of the original file. These are restored when the file is decompressed.

When constructing GZip files, the file format is that of a standard GZip file. An extension area is used in the header to record the load, execution attributes and length of the file. The extension area is in the format:

  Offset  Length             Value
    0       2        Length of extended data
    2       2        Header identifier (AC)
    4       2        Header length
    6       4        load address
    10      4        exec address
    14      4        attributes
    18      4        length
    22      4        reserved (0)
    26      4        reserved (0)
    30      4        reserved (0)

Quitting Squash

Squash can be quit using the normal method. Simply click MENU over the Squash iconbar icon and then click on the Quit option from the menu that is displayed.


This documentation is copyright 3QD Developments Ltd 2013 and may not be reproduced or published in any form without the copyright holder's permission. RISC OS is subject to continuous development and improvement as such all information is provided by 3QD Developments Ltd in good faith and is believed to be correct at the time of publication E&OE. 3QD Developments Ltd cannot accept any liability for any loss or damage arising from the use of any information provided as part of the RISC OS Documentation.

HTML document version r23142 (3rd November 2015)