2025-06-07 03:13:33 -05:00
2021-12-31 00:35:04 -06:00
2025-06-06 15:46:25 -05:00
2025-06-07 02:17:39 -05:00
2025-06-07 02:54:30 -05:00
2025-03-15 17:50:02 +01:00
2025-06-07 02:54:30 -05:00
2025-06-06 11:05:43 -05:00
2025-02-27 02:46:22 -06:00
2025-03-17 06:22:24 -05:00
2020-11-08 11:06:38 -06:00
2025-04-10 11:20:55 -05:00

squashfs

PkgGoDev Go Report Card

A PURE Go library to read squashfs. There is currently no plans to add archive creation support as it will almost always be better to just call mksquashfs. I could see some possible use cases, but probably won't spend time on it unless it's requested (open a discussion if you want this feature).

The library has two parts with this github.com/CalebQ42/squashfs being easy to use as it implements io/fs interfaces and doesn't expose unnecessary information. 95% this is the library you want. If you need lower level access to the information, use github.com/CalebQ42/squashfs/low where far more information is exposed.

Currently has support for reading squashfs files and extracting files and folders.

Special thanks to https://dr-emann.github.io/squashfs/ for some VERY important information in an easy to understand format. Thanks also to distri's squashfs library as I referenced it to figure some things out (and double check others).

Build tags

As of v1.1.0 this library has two optional build tags: no_gpl and no_obsolete. no_gpl disables the ability to read archives with lzo compression due to the library's gpl license. no_obsolete removes "obsolete" compression types for a reduced compilation size; currently this only disable lzma compression since it's superseded by xz.

FUSE

As of v1.0, FUSE capabilities has been moved to a separate library.

Limitations

  • No Xattr parsing.
  • Socket files are not extracted.
    • From my research, it seems like a socket file would be useless if it could be created.
  • Fifo files are ignored on darwin

Issues

  • Noticably slower then unsquashfs for extraction, especially on larger images.
    • This seems to be related to above along with the general optimization of unsquashfs and it's compression libraries.
    • Times seem to be largely dependent on file tree size and compression type.
      • My main testing image (~100MB) using Zstd takes ~2x longer.
      • An Arch Linux airootfs image (~780MB) using XZ compression with LZMA filters takes ~28x longer.
      • A Tensorflow docker image (~3.3GB) using Zstd takes ~3x longer.

Note: These numbers are using FastOptions(). DefaultOptions() takes ~2x longer.

Recommendations on Usage

Due to the above performance consideration, this library should only be used to access files within the archive without extraction, or to mount it via Fuse.

  • Neither of these use cases are largely effected by the issue above.
S
Description
A Go library to read squashfs archives.
Readme MIT 15 MiB
2026-03-08 06:11:15 -05:00
Languages
Go 100%