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. deleteLocal

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 complete

Examples

// 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
Previous
deleteFile
Next
disableDirectSave