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

spark.enableDirectSave

function enableDirectSave(): void

Enable direct saves to torchjs.org API.

When enabled, saves go directly to the API endpoint with credentials. Use this in authenticated contexts (like the playground page) where the application has access to authentication cookies.

This should only be used in contexts with proper authentication. Sandboxed iframes should use RPC-proxied saves instead.

Examples

// In authenticated context (has access to auth cookies)
spark.enableDirectSave();

// Now saves will use the API directly
await spark.save('kasumi/project/model.pt', weights);
Previous
disableDirectSave
Next
exists