open static method

Future<FileVectorStore> open(
  1. String path
)

Opens the store at path.

If the file exists, the whole file is loaded into memory. If it does not, the store starts empty and path is created on the first successful mutation. The parent directory must already exist.

Throws a FormatException if the file exists but is not a valid store, and a FileSystemException if the file cannot be read.

Implementation

static Future<FileVectorStore> open(String path) async {
  final file = File(path);
  final inner = await file.exists()
      ? InMemoryVectorStore.fromBytes(await file.readAsBytes())
      : InMemoryVectorStore();
  return FileVectorStore._(path, inner);
}