Skip to content

Instantly share code, notes, and snippets.

@jonnor
Created November 6, 2014 17:46
Show Gist options
  • Save jonnor/6d8f2f3fee946a6c3104 to your computer and use it in GitHub Desktop.
Save jonnor/6d8f2f3fee946a6c3104 to your computer and use it in GitHub Desktop.
NoFlo list components and metadata
var noflo = require('noflo');
var rootdir = './';
var loader = new noflo.ComponentLoader(rootdir);
loader.listComponents(function() {
console.log(loader.components);
Object.keys(loader.components).forEach(function(name) {
loader.load(name, function(component) {
console.log(name);
console.log(component.description);
// for each port, should look at the .options key
// it has "description, type, datatype etc"
console.log(component.inPorts);
console.log(component.outPorts);
});
});
});
@nahoskins
Copy link

I gather I am noding wrong.

@jonnor
Copy link
Author

jonnor commented Nov 7, 2014

@nahoskins that is the printout of the components. Some time later (depending on how fast your harddrive is) you should get info per component

@jonnor
Copy link
Author

jonnor commented Nov 7, 2014

you seem to be running it from NoFlo itself, could be that the "Graph" there is causing a problem?

@JamesHagerman
Copy link

Here's an updated version. Apparently, the load() method's first parameter is returned as null... no idea why that changed but whatever:

var rootdir = './';
var loader = new noflo.ComponentLoader(rootdir);
loader.listComponents(function() {
  console.log(loader.components);

  Object.keys(loader.components).forEach(function(name) {
    loader.load(name, function(derp, component) {
      console.log(name);
      console.log(component.description);

      // for each port, should look at the .options key
      // it has "description, type, datatype etc"
      console.log(component.inPorts);
      console.log(component.outPorts);
    });
  });

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment