2
$\begingroup$

This question already has an answer here:

I want to build something like ResourceData to distributing neural network models and paclets.

This system preferably has the following three features.

  • It's lazy.

Lazy means it will not load unless you call it.

var := var = Import["path"] will not load until call var.

  • It's asynchronous.

Asynchronous means it does not prevent you from doing other things when loading or downloading.

ResourceData is not asynchronous. URLDownloadSubmit is asynchronous when downloading.

  • It's has a progress bar.

This is not necessary, but it should at least remind you that the download or load is complete.

GeneralUtilities`ProgressPanel["Downloading...","something",0.5], this may helpful but not mult-files available.


Some Thoughts

  1. ResourceData is not asynchronous, because it must return a certain result, the loading is completed or $Failed.

So an asynchronous loading system can return Missing[] when it has not finished loading. Then we can use If[MissingQ@var,Return[]] to do further processing.

  1. A possible method of capturing assignment variables

f /: Set[x_, f[y__]] := doSomething[x,y];

then try var = f["file","url"], this may useful.

$\endgroup$

marked as duplicate by m_goldberg, Edmund, C. E., rcollyer, eyorble Sep 12 '18 at 21:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ Did you see this? $\endgroup$ – C. E. Sep 9 '18 at 11:02