A Dart package that implements package:file with a virtual file system backed by SQLite. Files and directories are stored in database tables instead of the regular file system.

Features

  • Full file system operations (create, read, write, delete, rename, copy)
  • Directory operations with recursive support
  • Large file support with automatic chunking (1MB chunks)
  • Optional gzip compression for efficient storage
  • Transaction support for data consistency
  • Access time tracking
  • CLI tools for import/export and file operations

Usage

import 'package:sqlite_file/sqlite_file.dart';

// Create an SQLite database
final fs = SqliteFileSystem(path: 'data.db');

// Use like any other file system
final file = fs.file('/example.txt');
file.writeAsStringSync('Hello, World!');
print(file.readAsStringSync()); // Hello, World!

CLI Tools

The package includes command-line tools:

# Find files in SQLite filesystem
dart run sqlite_file:find --db data.db --type f

# Import files from regular filesystem
dart run sqlite_file:import --db data.db /path/to/source /target/path

# Export files to regular filesystem
dart run sqlite_file:export --db data.db /source/path /path/to/destination

Libraries

sqlite_file