spark.listLocal
function listLocal(): Promise<string[]>List all keys stored in local browser storage (IndexedDB).
Returns all keys that have been saved with saveLocal. Useful for discovering available cached data and managing storage.
Returns all keys, not their data. Use
loadLocal to get data.Returns
Promise<string[]>– Promise resolving to array of all stored keys (empty if none)Examples
// Discover available checkpoints
const checkpoints = await spark.listLocal();
console.log('Available checkpoints:', checkpoints);
// Output: ['model-v1', 'model-v2', 'model-v3']
// Get storage status
const keys = await spark.listLocal();
console.log(`Storage has ${keys.length} items`);
// Display to user for selection
const userOptions = await spark.listLocal();
const selected = userOptions[userOptions.length - 1]; // Get latestSee Also
- existsLocal - Check if single key exists
- getLocalStorageInfo - Get detailed storage information