spark.enableDirectSave
function enableDirectSave(): voidEnable 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);