class NpmPackageParser extends ComponentSupport {

  public Map<String, Object> parsePackageJson(final Supplier<InputStream> supplier) {
    try (InputStream is = new BufferedInputStream(supplier.get())) {
      final CompressorStreamFactory compressorStreamFactory = new CompressorStreamFactory();
      try (InputStream cis = compressorStreamFactory.createCompressorInputStream(GZIP, is)) {
        final ArchiveStreamFactory archiveFactory = new ArchiveStreamFactory();
        try (ArchiveInputStream ais = archiveFactory.createArchiveInputStream(TAR, cis)) {
          return parsePackageJsonInternal(ais);
        }
      }
    }
    catch (Exception e) {
      log.debug("Error occurred while processing package.json, returning empty map to continue", e);
      return emptyMap();
    }
  }

}