Class HttpNpmRemote

java.lang.Object
com.artipie.npm.proxy.HttpNpmRemote
All Implemented Interfaces:
NpmRemote, Closeable, AutoCloseable

public final class HttpNpmRemote extends Object implements NpmRemote
Base NPM Remote client implementation. It calls remote NPM repository to download NPM packages and assets. It uses underlying Vertx Web Client inside and works in Rx-way.
  • Constructor Details

    • HttpNpmRemote

      public HttpNpmRemote(com.artipie.http.Slice origin)
      Ctor.
      Parameters:
      origin - Client slice
  • Method Details

    • loadPackage

      public io.reactivex.Maybe<NpmPackage> loadPackage(String name)
      Description copied from interface: NpmRemote
      Loads package from remote repository.
      Specified by:
      loadPackage in interface NpmRemote
      Parameters:
      name - Package name
      Returns:
      NPM package or empty
    • loadAsset

      public io.reactivex.Maybe<NpmAsset> loadAsset(String path, Path tmp)
      Description copied from interface: NpmRemote
      Loads asset from remote repository. Typical usage for client:
       Path tmp = <create temporary file>
       NpmAsset asset = remote.loadAsset(asset, tmp);
       ... consumes asset's data ...
       Files.delete(tmp);
       
      Specified by:
      loadAsset in interface NpmRemote
      Parameters:
      path - Asset path
      tmp - Temporary file to store asset data
      Returns:
      NpmAsset or empty
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable