Function Repository Resource:

LocalResourceObjects

Source Notebook

Get a list of locally stored resource objects

Contributed by: Bob Sandheinrich

ResourceFunction["LocalResourceObjects"][]

returns a list of all resource objects stored on the computer.

ResourceFunction["LocalResourceObjects"][types]

only returns resources of the specified types.

ResourceFunction["LocalResourceObjects"][types,prop]

gives the property prop for each resource.

Details and Options

Locally stored resources include both cached resources from the public repositories and custom resources created on the computer.
Published resources are considered locally cached if the resource object information has been retrieved, even if the contents or data of the resource have not been downloaded from the repository.
Typically, resource types correspond to a published repository:
The types can be either a single resource type or a list.
The property prop supports any property supported by ResourceObject[][prop], including "Name", "Description" and "ResourceType".
LocalResourceObject supports the option MaxItems with default value Infinity.

Examples

Basic Examples (2) 

List all locally stored resource objects:

In[1]:=
ResourceFunction["LocalResourceObjects"][] // Short
Out[1]=
Image

Find a few locally stored neural net resource objects:

In[2]:=
ResourceFunction["LocalResourceObjects"]["NeuralNet", MaxItems -> 3]
Out[2]=
Image

Scope (6) 

Find resources of multiple types:

In[3]:=
ResourceFunction["LocalResourceObjects"][{"Data", "Function"}, MaxItems -> 10]
Out[3]=
Image

Display names for all local data resources:

In[4]:=
ResourceFunction["LocalResourceObjects"]["Data", "Name"] // Short
Out[4]=
Image

Retrieve a NetModel for each "NeuralNet" resource using the name for a label:

In[5]:=
Labeled[NetModel[#], #] & /@ ResourceFunction["LocalResourceObjects"]["NeuralNet", "Name", MaxItems -> 3]
Out[5]=
Image

Retrieve a ResourceFunction for each "Function" resource:

In[6]:=
ResourceFunction /@ ResourceFunction["LocalResourceObjects"]["Function", MaxItems -> 10]
Out[6]=
Image

Find a few locally cached resources from the public resource system:

In[7]:=
RandomChoice[
 Select[ResourceFunction[
   "LocalResourceObjects"][], #["RepositoryLocation"] === URL[$ResourceSystemBase] &], 7]
Out[7]=
Image

Find a random ResourceObject created on this computer:

In[8]:=
RandomChoice[
 Select[ResourceFunction[
   "LocalResourceObjects"][], ! MatchQ[#["RepositoryLocation"], _URL] &]]
Out[8]=
Image

Neat Examples (1) 

Create a dynamic tool for browsing locally cached resource functions:

In[9]:=
ResourceFunction["DynamicListView"][
 With[{n = #}, Button[n, CopyToClipboard[ResourceFunction[n]]]] & /@ Sort[ResourceFunction["LocalResourceObjects"]["Function", "Name"]], 10]
Out[9]=
Image

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 2.0.0 – 02 March 2021
  • 1.0.0 – 15 March 2019

Related Resources

Author Notes

Version 2.0.0: adding support for property specification; added support for MaxItems option; improved speed for many resources.

License Information