Skip to main content

Module file_system

Module file_system 

Source
Expand description

File system access (DuckDB 1.5.0+).

This module exposes DuckDB’s virtual file system (VFS) to extensions, so a custom table function, replacement scan, or copy function can read and write files through the same abstraction DuckDB uses internally. That means transparently honouring httpfs (s3://, http://), in-memory files, and any other registered file system — rather than reaching for std::fs and only ever seeing local disk.

§Obtaining a FileSystem

Get one from a ClientContext (which you can obtain from most function callbacks):

use quack_rs::client_context::ClientContext;
use quack_rs::file_system::{FileOpenOptions, FileSystem};

let fs = FileSystem::from_client_context(ctx)?;
let opts = FileOpenOptions::read_only();
let handle = fs.open(c"data.csv", &opts).ok()?;
let mut contents = Vec::new();
handle.read_to_end(&mut contents).ok()?;

Structs§

FileHandle
RAII wrapper for an open duckdb_file_handle.
FileOpenOptions
RAII wrapper for duckdb_file_open_options.
FileSystem
RAII wrapper for a duckdb_file_system.

Enums§

FileFlag
A file-open mode flag, mirroring duckdb_file_flag.