@lix-js/storage-filesystem
v0.12.2
Published
Filesystem-backed storage for Lix. The Rust crate and JavaScript package expose the same adapter with independently versioned releases.
Readme
lix-storage-filesystem
Filesystem-backed storage for Lix. The Rust crate and JavaScript package expose the same adapter with independently versioned releases.
JavaScript
import { openLix } from "@lix-js/sdk";
import { FilesystemStorage } from "@lix-js/storage-filesystem";
const storage = new FilesystemStorage({ path: "./repository" });
const lix = await openLix({ storage });The whole repository is synchronized by default. Pass syncAllFiles: false
and use storage.importPaths(paths) for selective synchronization.
Rust
use lix::open_lix;
use lix_storage_filesystem::FilesystemStorage;
# async fn example() -> Result<(), lix::LixError> {
let storage = FilesystemStorage::new("./repository").open()?;
let lix = open_lix().with_storage(storage.clone()).await?;
storage.start_sync(&lix).await?;
# Ok(())
# }The storage owns synchronization until storage.stop_sync().await? or until
the final storage/repository instance is dropped. Explicitly stopping is useful
for tests and before immediately reopening the same path.
