Skip to main content
torch.js has not been released yet.
torch.js logotorch.js logotorch.js
PlaygroundContact
Login
Documentation
IntroductionType SafetyTensor ExpressionsTensor IndexingEinsumEinopsAutogradTraining a ModelProfiling & MemoryPyTorch MigrationBest PracticesRuntimesPerformancePyTorch CompatibilityBenchmarksDType Coverage
torch.js· 2026
LegalTerms of UsePrivacy Policy
/
/
  1. docs
  2. Spark
  3. spark
  4. clearLocal

spark.clearLocal

function clearLocal(): Promise<void>

Clear all data from local browser storage (IndexedDB).

Removes all stored data at once. Useful for:

  • Resetting to fresh state
  • Freeing up storage space
  • Testing or debugging
  • User-initiated "reset" action
This is permanent and irrevocable. All locally cached data will be lost. Consider prompting the user before calling this.

Returns

Promise<void>– Promise that resolves when all data is cleared

Examples

// Full reset - clear everything
await spark.clearLocal();
console.log('All local data cleared');

// Clear on user request
async function handleResetButton() {
  if (confirm('Clear all cached data?')) {
    await spark.clearLocal();
    // Reload or reinitialize application
  }
}

See Also

  • deleteLocal - Delete single key
  • listLocal - List all keys before clearing
Previous
buildFileUrl
Next
createParentRpc