spark.deleteLocal
function deleteLocal(key: string): Promise<void>Delete data from local browser storage (IndexedDB).
Removes a previously saved entry from local storage. Does nothing silently if the key doesn't exist.
Parameters
keystring- Unique identifier for the data to delete
Returns
Promise<void>– Promise that resolves when deletion is completeExamples
// Delete old checkpoint to save space
await spark.deleteLocal('old-checkpoint');
// Clean up temporary data
await spark.deleteLocal(`temp-epoch-${oldEpoch}`);
// Delete with error handling
try {
await spark.deleteLocal('checkpoint-to-remove');
console.log('Deleted successfully');
} catch (err) {
console.error('Failed to delete:', err);
}See Also
- saveLocal - Save to local storage
- clearLocal - Delete all local storage