https://github.com/pkgforge/squishy-rs
Convenient high level library for reading SquashFS files in Rust [maintainer=@QaidVoid]
https://github.com/pkgforge/squishy-rs
Last synced: 10 months ago
JSON representation
Convenient high level library for reading SquashFS files in Rust [maintainer=@QaidVoid]
- Host: GitHub
- URL: https://github.com/pkgforge/squishy-rs
- Owner: pkgforge
- License: mit
- Created: 2024-11-07T03:17:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-14T14:53:45.000Z (about 1 year ago)
- Last Synced: 2025-03-27T20:11:16.536Z (11 months ago)
- Language: Rust
- Homepage:
- Size: 77.1 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🗜️ Squishy
[](https://opensource.org/licenses/MIT)
A convenient wrapper around the [backhand](https://github.com/wcampbell0x2a/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
```bash
cargo install squishy-cli
```
### From source
```bash
git clone https://github.com/pkgforge/squishy-rs
cd squishy-rs
cargo install --path squishy-cli
```
## Library Usage
Add this to your `Cargo.toml`:
```toml
[dependencies]
squishy = "0.2.1"
```
### Example
```rust
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
```bash
# 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](LICENSE) file for details.