Skip to content

tridium/niagara-moduledev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

niagara-moduledev

Translates web requests for Niagara module resources into absolute file paths from moduledev.properties. Accepts either /module/ URLs or module:// ORDs.

var moduledev = require('niagara-moduledev'),
    path = 'd:\\niagara\\r43\\niagara_home\\etc\\moduledev.properties';
    
moduledev.fromFile(path, function (err, md) {
  var url = '/module/bajaScript/rc/virt.js',
      ord = 'module://bajaScript/rc/coll.js',
      notFound = '/module/blahjaSkript/rc/nope.js';

  md.getFilePath(url, function (err, filePath) {
    console.log(String(fs.readFileSync(filePath)));
  });

  md.getFilePath(ord, function (err, filePath) {
    console.log(String(fs.readFileSync(filePath)));
  });
  
  md.getFilePath(notFound, function (err, filePath) {
    console.error(err);
  });
});

About

moduledev.properties support for node

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published