lib/index.js
function writeHTMLFile(options) {
  return new Promise(function(resolve, reject) {
    var templateFile = path.join(__dirname, '../template/cli.html');
     // read our template file
     fs.readFile(templateFile, 'utf8', function (err,data) {
      if (err) {
        reject(err);
      }
      // insert the generated json data
      var result = data.replace('{{ insertJSONHere }}', 'var embeddedJsonData = '+ options.json + ';');

      // write file to directory
      fs.writeFile(path.join(options.directory, 'index.html'), result, 'utf8', function (err) {
         if (err) {
          reject(err);
         }
         resolve(options.directory);
      });
    });
  });
}
function writeHTMLFile(options) {
  return new Promise(function(resolve, reject) {
    var templateFile = path.join(__dirname, '../template/cli.html');
     // read our template file
     fs.readFile(templateFile, 'utf8', function (err,data) {
      if (err) {
        reject(err);
      }
      // insert the generated json data
      var result = data.replace('{{ insertJSONHere }}', 'var embeddedJsonData = '+ options.json + ';');

      // write file to directory
      fs.writeFile(path.join(options.directory, 'index.html'), result, 'utf8', function (err) {
         if (err) {
          reject(err);
         }
         resolve(options.directory);
      });
    });
  });
}
function writeHTMLFile ( options ) { return new Promise ( function ( resolve , reject ) { var templateFile = path . join ( __dirname , '../template/cli.html' ) ; // read our template file fs . readFile ( templateFile , 'utf8' , function ( err , data ) { if ( err ) { reject ( err ) ; } // insert the generated json data var result = data . replace ( '{{ insertJSONHere }}' , 'var embeddedJsonData = ' + options . json + ';' ) ; // write file to directory fs . writeFile ( path . join ( options . directory , 'index.html' ) , result , 'utf8' , function ( err ) { if ( err ) { reject ( err ) ; } resolve ( options . directory ) ; } ) ; } ) ; } ) ; }
This method creates index.html with injected data.

@param  {Object}  options            Options data
@param  {String}  options.directory  Directory
@param  {Object}  options.json       JSON data.
@return {void}
This method creates index . html with injected data .