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

spark.buildFileUrl

function buildFileUrl(path: string): string

Build a full API URL for accessing a file on torchjs.org.

Constructs the complete URL for downloading a file by combining the base URL, username, project, and filename. This is used internally by other load functions.

This is an internal utility function. Most users should use load, loadText, or loadJSON instead.

Parameters

pathstring
File path in format "username/project/filename"

Returns

string– Full API URL for file access (properly URL-encoded)

Examples

const url = spark.buildFileUrl('kasumi/mnist/model.pt');
// Result: 'https://torchjs.org/api/files/kasumi/mnist/model.pt'
Previous
File I/O
Next
clearLocal