MCPcopy Create free account
hub / github.com/csound/csound / CopyUrlToLocal

Function CopyUrlToLocal

Emscripten/src/csound.js:366–377  ·  view source on GitHub ↗

* Copies a URL file to local/. (not persistent). * * NB: works with the origin URL and CORS-ready URLs * * @param {string} url The url name * @param {string} name The file name * @param {function} callback completion callback

(url, name, callback = null)

Source from the content-addressed store, hash-verified

364 * @param {function} callback completion callback
365 */
366 function CopyUrlToLocal(url, name, callback = null) {
367 var xmlHttpRequest = new XMLHttpRequest();
368 xmlHttpRequest.onload = function() {
369 var data = new Uint8Array(xmlHttpRequest.response);
370 csound.Csound.writeToFS(name, data);
371 callback();
372 };
373 xmlHttpRequest.open("get", url, true);
374 xmlHttpRequest.responseType = "arraybuffer";
375 xmlHttpRequest.send(null);
376
377 }
378
379 function Message(text) {
380 csound.UpdateStatus(text);

Callers 2

PlayCsdFunction · 0.85
RenderCsdFunction · 0.85

Calls 2

openMethod · 0.80
writeToFSMethod · 0.45

Tested by

no test coverage detected