function createLensLibraryJson(lensObject) {
  const re = /(?:\.([^.]+))?$/;
  const zip = AdmZip(lensObject.library);
  const zipEntries = zip.getEntries();

  const zipContents = {};
  for (let j = 0; j < zipEntries.length; j++) {
    let ext = re.exec(zipEntries[j].entryName)[ONE] || '';
    ext = ext.toLowerCase();

    // handle different file types here
    if (ext === 'png' || ext === 'jpg' || ext === 'jpeg') {
      const b64str = zipEntries[j].getData().toString('base64');
      zipContents[zipEntries[j].entryName] = b64str;
    } else {
      zipContents[zipEntries[j].entryName] = zip.readAsText(
        zipEntries[j]
      );
    }
  }

  return zipContents;
}
/**
 * Create Json for files in Lens library with format, filename: file contents.
 * @param  {Object} lensObject - lens object
 * @returns {Object} zipContents - Json prepared from library contents.
 */
Create Json for files in Lens library with format, filename: file contents.
@param  {Object} lensObject - lens object
@returns {Object} zipContents - Json prepared from library contents.
Create Json for files in Lens library with format filename : file contents . @param { Object } lensObject - lens object @returns { Object } zipContents - Json prepared from library contents .
function createLensLibraryJson(lensObject) {
  const re = /(?:\.([^.]+))?$/;
  const zip = AdmZip(lensObject.library);
  const zipEntries = zip.getEntries();
  const zipContents = {};
  for (let j = 0; j < zipEntries.length; j++) {
    let ext = re.exec(zipEntries[j].entryName)[ONE] || '';
    ext = ext.toLowerCase();
    if (ext === 'png' || ext === 'jpg' || ext === 'jpeg') {
      const b64str = zipEntries[j].getData().toString('base64');
      zipContents[zipEntries[j].entryName] = b64str;
    } else {
      zipContents[zipEntries[j].entryName] = zip.readAsText(
        zipEntries[j]
      );
    }
  }
  return zipContents;
}
function createLensLibraryJson ( lensObject ) { const re = / (?:\.([^.]+))?$ / ; const zip = AdmZip ( lensObject . library ) ; const zipEntries = zip . getEntries ( ) ; const zipContents = { } ; for ( let j = 0 ; j < zipEntries . length ; j ++ ) { let ext = re . exec ( zipEntries [ j ] . entryName ) [ ONE ] || '' ; ext = ext . toLowerCase ( ) ; if ( ext === 'png' || ext === 'jpg' || ext === 'jpeg' ) { const b64str = zipEntries [ j ] . getData ( ) . toString ( 'base64' ) ; zipContents [ zipEntries [ j ] . entryName ] = b64str ; } else { zipContents [ zipEntries [ j ] . entryName ] = zip . readAsText ( zipEntries [ j ] ) ; } } return zipContents ; }
Create Json for files in Lens library with format, filename: file contents.
Create Json for files in Lens library with format filename : file contents .
// handle different file types here