Skip to content

Convenient high level library for reading SquashFS files in Rust [maintainer=@QaidVoid]

License

Notifications You must be signed in to change notification settings

pkgforge/squishy-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗜️ Squishy

License: MIT

A convenient wrapper around the backhand library for reading and extracting files from SquashFS filesystems. Provides both a library and CLI tool.

Features

  • 📚 Library Features

    • Read and extract files from SquashFS filesystems
    • Traverse filesystem entries
    • Handle symlinks with cycle detection
    • Search for files using custom predicates
  • 🛠️ CLI Features

    • Extract AppImage resources:
      • Icon files (PNG/SVG)
      • Desktop entries
      • AppStream metadata
    • Flexible output options

Installation

From crates.io

cargo install squishy-cli

From source

git clone https://github.com/pkgforge/squishy-rs
cd squishy-rs
cargo install --path squishy-cli

Library Usage

Add this to your Cargo.toml:

[dependencies]
squishy = "0.2.1"

Example

use squishy::{SquashFS, EntryKind};
use std::path::Path;

// Open a SquashFS file
let squashfs = SquashFS::from_path(&Path::new("example.squashfs"))?;

// List all entries
for entry in squashfs.entries() {
    println!("{}", entry.path.display());
}

// Optionally, parallel read with rayon
use rayon::iter::ParallelIterator;
for entry in squashfs.par_entries() {
    println!("{}", entry.path.display());
}

// Write file entries to disk
for entry in squashfs.entries() {
    if let EntryKind::File(file) = entry.kind {
        squashfs.write_file(file, "/path/to/output/file")?;
    }
}

// Read a specific file
// Note: the whole file content will be loaded into memory
let contents = squashfs.read_file("path/to/file.txt")?;

CLI Usage

The CLI tool provides convenient commands for working with AppImage files.

Basic Commands

# Extract icon from an AppImage
squishy appimage path/to/app.AppImage --icon

# Extract desktop file
squishy appimage path/to/app.AppImage --desktop

# Extract AppStream metadata
squishy appimage path/to/app.AppImage --appstream

# Extract and save files to a specific directory
squishy appimage path/to/app.AppImage --icon --write /output/path

# Extract multiple resources at once
squishy appimage path/to/app.AppImage --icon --desktop --appstream --write

# Filter path by query
squishy appimage path/to/app.AppImage --filter "squishy" --icon --desktop --appstream --write

# Provide custom offset (it'd be calculated automatically if not provided)
# Appimage offset can be read using `path/to/app.AppImage --appimage-offset`
squishy appimage path/to/app.AppImage --offset 128128 --icon --desktop --appstream --write

# Extract contents of squashfs to a specific directory
squishy unsquashfs path/to/app.AppImage -w /output/path

Command Options

  • --offset: Custom offset (i.e. the size of ELF)
  • --filter: Filter the files using provided query
  • --icon: Extract application icon
  • --desktop: Extract desktop entry file
  • --appstream: Extract AppStream metadata
  • --write: Write files to disk (optional path argument)

License

This project is licensed under the [MIT] License - see the LICENSE file for details.

About

Convenient high level library for reading SquashFS files in Rust [maintainer=@QaidVoid]

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages