javabin
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

JavaBin

NPM VERSION DOWNLOADS LICENSE BUILD Codacy Badge Codacy Badge

JavaBin is a library that can be used to download all Amazon Corretto resources from Node.js.

Table of Contents:

Documentation

Install

To add this librery to your proyect use this command.

npm i javabin

If you want use the CLI use this command.

npm i -g javabin

To get help of javabin CLI use command javabin -h.

Getting Started

To use this librery you need to import it frist.

import JavaBin from "javabin";

// or

const JavaBin = require("javabin");

and before get an instance.

const JavaVersion = JavaBin.getInstance(); // Returns Promise<JavaVersion>

The method getInstance request all data from the oficial github of Amazon Corretto.

JavaVersion Class

List Platforms

If you want list all platforms available you can use this method.

JavaVersion.listPlatforms();

This method returns array all platforms.

List Architectures of Platform

Parameters:

  • platform: The name of the platform from which you want to obtain its architectures.

Returns:

It method returns an array with all architectures.

JavaVersion.getPlatformArchs("windows");

List Architectures

This method list all platforms with their respective architectures.

Returns:

This method returns an object with each platform in the keys and in each one an array with its possible architectures.

Example:

{
    "windows": ["x64", "x86"],
    "linux": ["x64", "x86", "arm"],
    ...
}
JavaVersion.listArchs();

Get Platform

Parameters:

  • Platform: The name of platform.
  • Arch: The architecture you need.

Returns:

This method return an Platform class instance.

JavaVersion.platform("linux","x64");

Platform Class

List JRE versions

This method list all JRE versions that are available.

JavaVersion.platform("linux", "x64").listJreVersions();

List JDK versions

This method list all JDK versions that are available.

JavaVersion.platform("linux", "x64").listJdkVersions();

List Versions

This method list all versions that are available.

Returns:

An object with two keys (JRE, JDK) and in each of its available versions.

Example:

{
    "jdk": ["8", "11"...],
    "jre": ["8", "11"...]
}
JavaVersion.platform("linux", "x64").listVersions();

Get JRE version

To get an JRE version you can use this method.

Parameters:

  • Version: The version you want get.

Returns:

This method return an instance of JavaBinariesFormats.

JavaVersion.platform("windows","x64").jre(8);

Get JDK version

To get an JDK version you can use this method.

Parameters:

  • Version: The version you want get.

Returns:

This method return an instance of JavaBinariesFormats.

JavaVersion.platform("windows","x64").jdk(11);

JavaBinariesFomarts Class

This class is used to select the format of JavaBinary.

List Formats

This method is used to list all formats for JavaBinary.

Returns:

Returns array with all formats.

Example:

[
    "zip", "msi", "exe"...
]
JavaVersion.platform("win", "x64").jdk(11).listFormats();

Get JavaBinary for format

This method is used to get an format for JavaVersion.

Returns:

Returns an instance of JavaBinary.

JavaVersion.platform("win", "x64").jdk(11).format("zip");

JavaBinary class

GetDownloadURL

Method getDownloadUrl:

This method returns the download url for the JavaBinary.

Download

Method download:

This method download return an IncomingDownload.

Parameters:

  • downloadPath optional: The path where the binary is downloaded. If you not specify an path will be downloaded in the current working directory.

IncomingDownload

Events

Start

This event is triggered when the download starts.

Callback value:

Object:

{
    "total": 100,
    "javaBin": {...} // JavaBinary instance
}
Tick

This event is triggered when the download process advances.

Callback value:

Object:

{
    "total": 5616424,
    "tick": 15852
}
Complete

This event is triggered when the download process ends.

Callback value:

Object:

{
    "path":"path_to_java_binary",
    "filename": "java_binary_file_name",
    "javaBinary": {...} // JavaBinary instance
}

Package Sidebar

Install

npm i javabin

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

41.7 kB

Total Files

30

Last publish

Collaborators

  • veguidev