https://github.com/panz3r/firefox-bookmarks
Convert Firefox bookmark backup files directly to HTML format
https://github.com/panz3r/firefox-bookmarks
bookmarks cli firefox golang
Last synced: 5 days ago
JSON representation
Convert Firefox bookmark backup files directly to HTML format
- Host: GitHub
- URL: https://github.com/panz3r/firefox-bookmarks
- Owner: panz3r
- License: other
- Created: 2025-06-11T01:17:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-06-02T03:07:35.000Z (22 days ago)
- Last Synced: 2026-06-02T05:07:08.607Z (22 days ago)
- Topics: bookmarks, cli, firefox, golang
- Language: Go
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Firefox Bookmarks Backup to HTML Converter
A fast, dependency-free tool that converts Firefox bookmark backup files directly to HTML format.
## ๐ Features
- **Direct conversion**: Convert Firefox `.jsonlz4` backup files directly to HTML without intermediate steps
- **JSON support**: Also supports regular `.json` bookmark files
- **Automatic file detection**: Automatically detects the input file format
- **Preserves metadata**: Maintains bookmark timestamps and descriptions
- **Standard format**: Outputs HTML in the standard Netscape bookmark format
- **Zero dependencies**: Single binary, no runtime requirements
- **Cross-platform**: Builds for Windows, macOS, and Linux
## ๐ฅ Installation
### Pre-built Binaries (Recommended)
Download the latest pre-built binary for your platform from the [releases page](https://github.com/panz3r/firefox-bookmarks/releases).
#### Linux/macOS
```bash
# Download and install (replace $VERSION with the latest version)
curl -L -o firefox-bookmarks "https://github.com/panz3r/firefox-bookmarks/releases/download/v$VERSION/firefox-bookmarks-linux-amd64"
# Make executable
chmod +x firefox-bookmarks
# Move to PATH (optional)
sudo mv firefox-bookmarks /usr/local/bin/
```
#### Windows
1. Download `firefox-bookmarks-windows-amd64.exe` from the [releases page](https://github.com/panz3r/firefox-bookmarks/releases)
2. Rename to `firefox-bookmarks.exe` (optional)
3. Place in a directory in your PATH, or run directly
#### Platform-specific downloads:
- **Linux AMD64**: `firefox-bookmarks-linux-amd64`
- **Linux ARM64**: `firefox-bookmarks-linux-arm64`
- **macOS AMD64**: `firefox-bookmarks-darwin-amd64`
- **macOS ARM64**: `firefox-bookmarks-darwin-arm64` (Apple Silicon)
- **Windows AMD64**: `firefox-bookmarks-windows-amd64.exe`
- **Windows ARM64**: `firefox-bookmarks-windows-arm64.exe`
### Build from Source
```bash
# Clone and build
git clone git@github.com:panz3r/firefox-bookmarks.git
cd firefox-bookmarks
# Build for current platform
make build
# Or build for all platforms
make build-all
```
### Available Make Commands
```bash
# See all available commands
make help
# Development workflow
make dev # Full development setup (deps + build + test)
make quick # Quick build and test
# Building
make build # Build for current platform
make build-all # Build for all platforms
# Testing
make test # Run all tests
make test-cover # Run tests with coverage
make benchmark # Performance comparison vs Python version
# Examples
make example # Run example demonstration
make run-example # Quick test with sample file
# Utilities
make clean # Clean build artifacts
make format # Format code
make info # Show project information
```
## ๐ Usage
### Basic Usage
```bash
# Show help
./firefox-bookmarks -help
# Convert with auto-generated output filename
./firefox-bookmarks backup.jsonlz4
# Convert with custom output filename
./firefox-bookmarks -o my_bookmarks.html backup.jsonlz4
# Convert JSON bookmark file
./firefox-bookmarks -o bookmarks.html bookmarks.json
```
**Note**: Flags must come before the input file.
## ๐ Input File Formats
### Firefox `.jsonlz4` backup files
#### Location
- **Linux/macOS**: `~/.mozilla/firefox/[profile]/bookmarkbackups/`
- **Windows**: `%APPDATA%\Mozilla\Firefox\Profiles\[profile]\bookmarkbackups\`
#### Format
- **Filename:** `bookmarks-YYYY-MM-DD_HHMMSS_randomhash.jsonlz4`
- These are compressed backup files created automatically by Firefox
### JSON bookmark files
- Regular JSON files containing Firefox bookmark data
- Can be created by manually exporting bookmarks
## ๐ Output Format
Generates HTML files in the standard Netscape bookmark format, compatible with:
- Firefox, Chrome, Safari, Edge, Opera
- Most bookmark management tools
- Other bookmark converters
## ๐ง How it works
1. **File Detection**: The tool automatically detects whether the input is a compressed `.jsonlz4` file or a regular JSON file
2. **Decompression** (if needed): For `.jsonlz4` files, it removes the Mozilla LZ4 header and decompresses the content
3. **JSON Parsing**: Parses the bookmark data structure
4. **HTML Generation**: Recursively converts the bookmark tree to HTML format, preserving:
- Folder hierarchy
- Bookmark URLs and titles
- Creation and modification timestamps
- Bookmark descriptions (if present)
## ๐งช Example
Run the included demonstration:
```bash
make example
```
This will:
- Build the binary if needed
- Show usage examples
- Run a test conversion
- Display performance metrics
## ๐ Performance
- **Execution time**: ~5-10ms startup + processing
- **Memory usage**: ~8-12MB peak
- **Binary size**: ~2-3MB (no runtime dependencies)
- **Cross-platform**: Native binaries for all major platforms
## ๐ง Troubleshooting
### Binary not found or won't run
- Download the correct binary for your platform from `builds/`
- Make sure the binary has execute permissions: `chmod +x firefox-bookmarks`
- Build from source if needed: `make build`
### "not a valid Firefox bookmark backup file"
Ensure you're using a valid Firefox bookmark backup file from:
- **Linux**: `~/.mozilla/firefox/[profile]/bookmarkbackups/`
- **Windows**: `%APPDATA%\Mozilla\Firefox\Profiles\[profile]\bookmarkbackups\`
- **macOS**: `~/Library/Application Support/Firefox/Profiles/[profile]/bookmarkbackups/`
### File permission errors
Ensure you have read permissions for the input file and write permissions for the output directory.
## ๐ Legacy Python Version
The original Python implementation is still available in the `python/` directory. See [Python README](python/README.md) for details. The Python version requires Python 3.6+ and the `lz4` library, but produces identical output to the Go version.
## ๐ License
MIT License - see [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
This project builds upon excellent work from:
- **[json2html-bookmarks](https://github.com/andreax79/json2html-bookmarks)** by [Andrea Bonomi](https://github.com/andreax79)
- **[jsonlz4_to_json](https://github.com/Robotvasya/jsonlz4_to_json)** by [Robotvasya](https://github.com/Robotvasya)