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

spark.setBaseUrl

function setBaseUrl(url: string): void

Set the base URL for file operations.

By default, files are loaded from https://torchjs.org. Use this function to configure a different base URL for development, testing, or custom hosting.

Parameters

urlstring
Base URL to use for file operations (e.g., 'https://example.com' or 'http://localhost:3000')

Examples

// Use local development server
spark.setBaseUrl('http://localhost:3000');
const weights = await spark.load('kasumi/mnist/model.pt');

See Also

  • getBaseUrl - Get the current base URL
Previous
saveLocal
Next
setParentRpc