function readSslCertFile (file) {
  var cert,
      certs,
      contents;

  certs = [];
  cert = [];

  contents = fs.readFileSync(file, 'utf-8');
  contents.split('\n').forEach(function (line) {
    cert.push(line);
    if (line.startsWith('-----END ')) {
      certs.push(cert.join('\n'));
      cert = [];
    }
  });

  return certs;
}
/**
 * Read an SSL Certificate bundle.
 *
 * @param file {String}
 *        path to certificate bundle file, in PEM format.
 * @return {Array<String>}
 *         array of individual certificates found in bundle.
 */
Read an SSL Certificate bundle.
@param file {String}
path to certificate bundle file, in PEM format.
@return {Array}
array of individual certificates found in bundle.
Read an SSL Certificate bundle . @param file { String } path to certificate bundle file in PEM format . @return { Array } array of individual certificates found in bundle .
function readSslCertFile (file) {
  var cert,
      certs,
      contents;
  certs = [];
  cert = [];
  contents = fs.readFileSync(file, 'utf-8');
  contents.split('\n').forEach(function (line) {
    cert.push(line);
    if (line.startsWith('-----END ')) {
      certs.push(cert.join('\n'));
      cert = [];
    }
  });
  return certs;
}
function readSslCertFile ( file ) { var cert , certs , contents ; certs = [ ] ; cert = [ ] ; contents = fs . readFileSync ( file , 'utf-8' ) ; contents . split ( '\n' ) . forEach ( function ( line ) { cert . push ( line ) ; if ( line . startsWith ( '-----END ' ) ) { certs . push ( cert . join ( '\n' ) ) ; cert = [ ] ; } } ) ; return certs ; }
Read an SSL Certificate bundle.
Read an SSL Certificate bundle .