| Crates.io | reflo |
| lib.rs | reflo |
| version | 0.1.2 |
| created_at | 2026-01-03 07:10:54.362+00 |
| updated_at | 2026-01-03 20:06:56.130306+00 |
| description | Audio format converter for the flo™ audio format. Available as CLI and library with WebAssembly support |
| homepage | https://github.com/flo-audio/flo |
| repository | https://github.com/flo-audio/flo |
| max_upload_size | |
| id | 2019737 |
| size | 95,097 |
Audio format converter for the flo™ audio format. Available on crates.io! https://crates.io/crates/reflo
cargo install --path . --features cli
Or build from source:
cargo build --release --features cli
The binary will be available at target/release/flo.
Add to your Cargo.toml:
[dependencies]
reflo = { path = "path/to/reflo" }
Install wasm-pack:
cargo install wasm-pack
Build for web:
wasm-pack build --target web --features wasm --no-default-features
This generates a pkg/ directory with:
reflo.js - JavaScript bindingsreflo_bg.wasm - WebAssembly binary# Encode to flo (lossless)
flo encode input.mp3 output.flo
# Encode with lossy compression
flo encode input.wav output.flo --lossy --quality high
# Encode with target bitrate
flo encode input.flac output.flo --lossy --bitrate 320
# Decode to WAV
flo decode input.flo output.wav
# Show file info
flo info input.flo
# Show metadata
flo metadata input.flo
# Validate file
flo validate input.flo
use reflo::{encode_from_audio, decode_to_wav, EncodeOptions};
use std::fs;
// Read audio file
let audio_bytes = fs::read("input.mp3")?;
// Encode with options
let options = EncodeOptions::lossy(0.6) // High quality
.with_level(5);
let flo_bytes = encode_from_audio(&audio_bytes, options)?;
fs::write("output.flo", flo_bytes)?;
// Decode
let flo_bytes = fs::read("output.flo")?;
let wav_bytes = decode_to_wav(&flo_bytes)?;
fs::write("output.wav", wav_bytes)?;
<!DOCTYPE html>
<html>
<head>
<script type="module">
import init, {
encode_audio_to_flo,
decode_flo_to_wav,
get_flo_file_info
} from './pkg-reflo/reflo.js';
async function convertAudio() {
await init();
// Get file from input
const file = document.getElementById('input').files[0];
const audioBytes = new Uint8Array(await file.arrayBuffer());
// Encode to flo (lossy, high quality)
const floBytes = encode_audio_to_flo(
audioBytes,
true, // lossy
0.6, // quality (0.0-1.0)
5 // compression level
);
// Get info
const info = get_flo_file_info(floBytes);
console.log('Sample rate:', info.sample_rate);
console.log('Channels:', info.channels);
console.log('Compression:', info.compression_ratio);
// Decode back to WAV
const wavBytes = decode_flo_to_wav(floBytes);
// Download
const blob = new Blob([wavBytes], { type: 'audio/wav' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'output.wav';
a.click();
}
</script>
</head>
<body>
<input type="file" id="input" accept="audio/*">
<button onclick="convertAudio()">Convert</button>
</body>
</html>
encode_from_audio(bytes, options) - Encode audio to flo formatencode_from_samples(samples, sr, ch, metadata, options) - Encode raw samplesdecode_to_wav(bytes) - Decode flo to WAV formatdecode_to_samples(bytes) - Decode to raw samplesget_metadata(bytes) - Extract metadata from flo fileget_flo_info(bytes) - Get file informationget_audio_info(bytes) - Get audio file informationvalidate_flo(bytes) - Validate flo file integrityencode_audio_to_flo(audio_bytes, lossy, quality, level) - Encode to flodecode_flo_to_wav(flo_bytes) - Decode to WAVdecode_flo_to_samples(flo_bytes) - Decode to raw samples (returns object)get_flo_file_info(flo_bytes) - Get file infoget_audio_file_info(audio_bytes) - Get audio infoget_flo_metadata_json(flo_bytes) - Get metadata as JSONvalidate_flo_file(flo_bytes) - Validate fileThe crate is structured for maximum code reuse:
reflo/
├── src/
│ ├── lib.rs # Core library API (cross-platform)
│ ├── audio.rs # Audio I/O using Symphonia
│ ├── main.rs # CLI binary (feature: cli)
│ └── wasm.rs # WASM bindings (feature: wasm)
lib.rs works with Vec<u8> for portabilityaudio.rs uses Symphonia (works on all targets)main.rs adds file system operationswasm.rs adds JavaScript bindingsNo platform-specific code in the core - it all works on native and WASM!
# Native CLI
cargo build --release --features cli
# Library only
cargo build --release --no-default-features
# WebAssembly
wasm-pack build --target web --features wasm --no-default-features
# All features (for testing)
cargo build --all-features
Apache 2.0 License - see LICENSE