| Crates.io | ffcv |
| lib.rs | ffcv |
| version | 1.1.1 |
| created_at | 2026-01-08 02:48:16.119289+00 |
| updated_at | 2026-01-09 22:41:37.733619+00 |
| description | Firefox Configuration Viewer - Parse and query Firefox preference files |
| homepage | |
| repository | https://github.com/darkcodi/ffcv |
| max_upload_size | |
| id | 2029429 |
| size | 390,273 |
Firefox Configuration Viewer - Parse and query Firefox preference files with ease.
ffcv is both a command-line tool and a Rust library for working with Firefox's prefs.js configuration files. It provides a structured way to parse, query, and understand Firefox settings across all platforms (Linux, macOS, Windows).
user_pref)pref)lock_pref)sticky_pref)"network.*" or "browser.*.enabled"Install via cargo:
cargo install ffcv
This installs the ffcv binary for viewing Firefox configurations from your terminal.
Add to your Cargo.toml:
[dependencies]
ffcv = "1.1.1"
# List all Firefox profiles on your system
ffcv profile
# Specify a custom Firefox profiles directory
ffcv profile --profiles-dir /custom/path
# List detected Firefox installations
ffcv install
# List all Firefox installations (including multiple versions)
ffcv install --all
# Show detailed information about each installation
ffcv install --all --verbose
# View all preferences (includes Firefox defaults by default)
ffcv config
# View preferences for a specific profile
ffcv config --profile myprofile
# Query specific preferences by glob pattern
ffcv config --query "network.*"
ffcv config --query "browser.*" --query "extensions.*"
# Get a single preference (raw output)
ffcv config --get "network.proxy.type"
# View all preferences including built-in defaults
ffcv config --all
# View only user-modified preferences (default behavior)
ffcv config
# Specify custom Firefox installation directory
ffcv config --install-dir /usr/lib/firefox
# Read from stdin
cat prefs.js | ffcv config --stdin
# Output as JSON (includes source information)
ffcv config --output-type json-array
# Output as simple JSON object (no source information)
ffcv config --output-type json-object
use ffcv::parse_prefs_js;
use std::fs;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let content = fs::read_to_string("prefs.js")?;
let entries = parse_prefs_js(&content)?;
for entry in entries {
println!("{:?} = {:?}", entry.key, entry.value);
}
Ok(())
}
use ffcv::{parse_prefs_js, query_preferences};
use std::fs;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let content = fs::read_to_string("prefs.js")?;
let entries = parse_prefs_js(&content)?;
// Query network-related preferences
let network_prefs = query_preferences(&entries, &["network.*"])?;
// Display matching entries
for entry in network_prefs {
println!("{} = {:?}", entry.key, entry.value);
}
Ok(())
}
use ffcv::list_profiles;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let profiles = list_profiles(None)?;
for profile in profiles {
println!("Profile: {}", profile.name);
println!(" Path: {}", profile.path.display());
println!(" Default: {}", profile.is_default);
}
Ok(())
}
use ffcv::find_firefox_installation;
fn main() -> Result<(), Box<dyn std::error::Error>> {
if let Some(installation) = find_firefox_installation()? {
println!("Firefox found at: {}", installation.path.display());
println!("Version: {}", installation.version);
println!("Has omni.ja: {}", installation.has_omni_ja);
println!("Has greprefs.js: {}", installation.has_greprefs);
} else {
println!("No Firefox installation found");
}
Ok(())
}
use ffcv::{merge_all_preferences, MergeConfig};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = MergeConfig {
include_builtins: true, // Include omni.ja defaults
include_globals: true, // Include greprefs.js
include_user: true, // Include user prefs.js
continue_on_error: true, // Don't fail if some sources are missing
};
let merged = merge_all_preferences(
&profile_path,
None, // Auto-detect Firefox installation
&config
)?;
println!("Loaded {} preferences", merged.entries.len());
println!("Sources: {:?}", merged.loaded_sources);
if !merged.warnings.is_empty() {
println!("Warnings:");
for warning in &merged.warnings {
println!(" - {}", warning);
}
}
Ok(())
}
use ffcv::{PrefEntry, PrefValue, PrefValueExt};
fn process_entry(entry: PrefEntry) {
// Use convenience methods from PrefValueExt trait
if let Some(enabled) = entry.value.as_bool() {
if enabled {
println!("{} is enabled", entry.key);
} else {
println!("{} is disabled", entry.key);
}
} else if let Some(n) = entry.value.as_int() {
println!("{} = {} (integer)", entry.key, n);
} else if let Some(s) = entry.value.as_string() {
println!("{} = \"{}\"", entry.key, s);
} else {
println!("{} = {:?}", entry.key, entry.value);
}
}
use ffcv::find_profile_path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Find a specific Firefox profile by name
let profile_path = find_profile_path("default", None)?;
println!("Profile path: {}", profile_path.display());
Ok(())
}
ffcv provides a clean, simplified API with all public types and functions available at the crate root:
Core Types:
PrefEntry - A single preference entry with key, value, type, and sourcePrefType - The type of preference (User, Default, Locked, Sticky)PrefValue - The value of a preference (Bool, Int, Float, String, Null)PrefValueExt - Convenience trait for type-safe value accessPrefSource - Where a preference came from (BuiltIn, GlobalDefault, User, SystemPolicy)FirefoxInstallation - Metadata about a Firefox installationMergedPreferences - Combined preferences from multiple sourcesCore Functions:
parse_prefs_js() - Parse preference file contentsparse_prefs_js_file() - Parse directly from a file pathquery_preferences() - Filter preferences by glob patternsmerge_all_preferences() - Merge preferences from all sourceslist_profiles() - List all Firefox profilesfind_profile_path() - Find a specific profile by namefind_firefox_installation() - Auto-detect Firefox installationget_prefs_path() - Get the prefs.js path for a profileAll functions return Result<T, Error> for proper error handling.
Firefox uses several types of preferences:
user_pref) - Set by the userpref) - Application defaultslock_pref) - Administratively locked, cannot be changedsticky_pref) - User preferences that persist across updatesEach preference has a value type:
true/false)ffcv respects the following environment variables for Firefox profile discovery:
FIREFOX_BIN - Path to Firefox binaryMOZ_PROFILES_DIR - Custom Firefox profiles directoryPROGRAMFILES - Windows Program Files directory (for Firefox detection)HOME - User home directory (Unix-like systems)APPDATA - Application Data directory (Windows)Full API documentation is available on docs.rs.
To build and view the documentation locally:
cargo doc --open
ffcv is tested and supported on:
Contributions are welcome! Please feel free to submit a Pull Request.
This project is dual-licensed under either:
You may choose either license for your use.
ffcv provides a stable and well-tested API. The library offers a clean, simplified interface with comprehensive Firefox preference parsing capabilities. All public types and functions are available at the crate root for easy importing.
Built for the Rust community to make Firefox configuration management easier and more programmatic.
Inspired by the need for better tools to understand and manage Firefox's extensive preference system.