cli/download.js
function downloadCodeModule(db, module, codePath) {
  const moduleName = module.replace(/^\/code\//, '').replace(/\/module$/, '');
  const fileName = `${moduleName}.js`;
  const filePath = path.join(codePath, fileName);

  return db.code.loadCode(moduleName, 'module', false)
    .then((file) => writeFile(filePath, file))
    .then(() => console.log(`Module ${moduleName} downloaded.`));
}
function downloadCodeModule(db, module, codePath) {
  const moduleName = module.replace(/^\/code\//, '').replace(/\/module$/, '');
  const fileName = `${moduleName}.js`;
  const filePath = path.join(codePath, fileName);

  return db.code.loadCode(moduleName, 'module', false)
    .then((file) => writeFile(filePath, file))
    .then(() => console.log(`Module ${moduleName} downloaded.`));
}
function downloadCodeModule ( db , module , codePath ) { const moduleName = module . replace ( / ^\/code\/ / , '' ) . replace ( / \/module$ / , '' ) ; const fileName = ` ${ moduleName } ` ; const filePath = path . join ( codePath , fileName ) ; return db . code . loadCode ( moduleName , 'module' , false ) . then ( ( file ) => writeFile ( filePath , file ) ) . then ( ( ) => console . log ( ` ${ moduleName } ` ) ) ; }
Downloads a single code module.

@param {EntityManager} db The entity manager to use.
@param {string} module The module to download.
@param {string} codePath The path where code should be downloaded to.
@return {Promise<void>} Resolves when downloading has been finished.
Downloads a single code module .