newLixFile(
args?: {keyValues?:NewStateByVersion<LixKeyValue>[]; }):Promise<NewLixBlob>
Creates a new Lix file as a NewLixBlob.
This function bootstraps an in-memory SQLite database with the necessary schema and metadata to represent a valid Lix project. The resulting blob is ready to be persisted to disk, IndexedDB, or other storage.
The returned blob has a ._lix property for immediate access to the
lix identifier and name without needing to open the file.
// Create a new lix file with default values
const blob = await newLixFile();
console.log(blob._lix.id); // e.g. "z2k9j6d"
console.log(blob._lix.name); // e.g. "blue-gorilla"// Create a new lix file with specific key-values
const blob = await newLixFile({
keyValues: [
{ key: "lix_name", value: "my-project", lixcol_version_id: "global" },
{ key: "lix_id", value: "custom-id", lixcol_version_id: "global" },
{ key: "my_custom_key", value: "my_custom_value", lixcol_version_id: "global" }
],
});
console.log(blob._lix.id); // "custom-id"
console.log(blob._lix.name); // "my-project"| Parameter | Type | Description |
|---|---|---|
args? | { keyValues?: NewStateByVersion<LixKeyValue>[]; } | - |
args.keyValues? | NewStateByVersion<LixKeyValue>[] | Pre-populates the key-value store of the new lix file. Use this to set initial values for lix_id, lix_name, or other custom keys. If lix_id or lix_name are not provided, they will be generated automatically. The lixcol_version_id defaults to the active version. Example keyValues: [ { key: "lix_name", value: "my-project", lixcol_version_id: "global" }, { key: "lix_id", value: "custom-id", lixcol_version_id: "global" }, { key: "my_custom_key", value: "my_custom_value", lixcol_version_id: "global" }, ] |
Promise<NewLixBlob>