The official Data Mining & Supply IO wrapper module.
Currently, DMS is in a private beta release and this package requires an active DMS account. Once out of beta, installing and using public supplies will no longer require an account or login prompt. Full documentation and more information can be found in the DMS Docs.
Loading the module:
var supply = ;
The @dms/io wrapper module loads as a function. Calling this function loads and initializes an instance of the Supply class.
Initializing a Supply:
Some examples for loading a supply using the /s/running-numbers supply:
// Using the default optionsvar mySupply =
// If we have data that looks like this:var data =id: "ABC"number: 10id: "ABC"number: 12id: "ABC"number: 15// ... then we might want to add some optionsvar mySupply =;
name - string name of the supply to load
options - optional object
- inputs - object for remapping input names
- parameters - object for tuning this supply's parameters
- bypass - array of field names to pass around this supply's logic
- version - specific version to load, defaults to newest installed
Using a Supply
Data can be sent through a supply as an array of data points, or one point at a time. The loaded supply object will remember whatever is required to mine the next data point. If the data argument is left out, it will default to
Using a supply's $main route
// asynchronously;// synchronouslyvar result = ;
Some supplies have multiple routes for data:
Using a supply's custom $on route
// asynchronouslymySupply;// synchronouslyvar result = mySupply;
// Check how many points a supply has minedconsole;// Access a supply's internal memoryvar memory = mySupply$;// Get the epoch time the supply was initializedconsole;
Exporting a supply's current state:
// Extract a supply's memory and settings as a base64 stringvar b64 = mySupply;// Extract a supply's memory and settings as an objectvar obj = mySupply;// Extract a supply's memory and settings as a stringified objectvar str = mySupply;
Configuring a supply from an exported state:
// Set a supply's memory and settings from a base64 stringmySupply;// Set a supply's memory and settings from an objectmySupply;// Set a supply's memory and settings from a stringified objectmySupply;
Check out https://datamining.supply for more info.