Expand description
File handling utilities for MoosicBox music server.
This crate provides comprehensive file operations for the MoosicBox music server, including:
- HTTP file operations - Download and stream files from remote URLs with progress tracking
- Media cover images - Fetch and cache album/artist cover artwork
- Audio file handling - Process and serve audio tracks in various formats
- Byte range support - Handle partial content requests for streaming media
§Features
api- Actix-web HTTP endpoints for file servicesfiles- Core file handling and track managementrange- Byte range parsing for partial content requestsimage/libvips- Image resizing and processing- Format-specific features:
format-aac,format-flac,format-mp3,format-opus
§Examples
Download and save a file from a remote URL:
let client = switchy_http::Client::new();
let file_path = std::path::Path::new("/tmp/audio.flac");
let url = "https://example.com/audio.flac";
fetch_and_save_bytes_from_remote_url(&client, file_path, url, None).await?;Modules§
- api
- HTTP API endpoints for file services using Actix-web.
- files
- Core file handling operations for tracks, albums, and artists.
- range
- Byte range parsing for HTTP partial content requests.
Structs§
- Cover
Bytes - Cover image bytes with optional size information.
Enums§
- Fetch
AndSave Bytes From Remote UrlError - Errors that can occur when fetching and saving bytes from a remote URL.
- Fetch
Cover Error - Errors that can occur when fetching cover artwork.
- GetContent
Length Error - Errors that can occur when retrieving content length from a remote URL.
- Save
Bytes Stream ToFile Error - Errors that can occur when saving a byte stream to a file.
Functions§
- fetch_
and_ save_ bytes_ from_ remote_ url - Downloads bytes from a remote URL and saves them to a file.
- fetch_
bytes_ from_ remote_ url - Fetches bytes from a remote URL as a stream.
- get_
content_ length - Retrieves the content length of a remote resource via HTTP HEAD request.
- sanitize_
filename - Sanitizes a filename by replacing all non-alphanumeric characters with underscores.
- save_
bytes_ stream_ to_ file - Saves a stream of bytes to a file, optionally starting at a byte offset.
- save_
bytes_ stream_ to_ file_ with_ progress_ listener - Saves a stream of bytes to a file with progress tracking.
- save_
bytes_ stream_ to_ file_ with_ speed_ listener - Saves a stream of bytes to a file with download speed and progress callbacks.
- save_
bytes_ to_ file - Saves bytes to a file at the specified path, optionally starting at a byte offset.
- search_
for_ cover - Searches for cover artwork in a directory or extracts it from audio file tags.