This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

etcher-latest-version

1.0.0 • Public • Published

etcher-latest-version

Utility to determine which is the latest published Etcher version

npm version dependencies Build Status

Installation

Install etcher-latest-version by running:

$ npm install --save etcher-latest-version

Documentation

module.exports(request, callback) ⏏

In order to make this function easily usable in both NodeJS and the browser, we decouple the latest version finder logic from the function that performs the HTTP GET request to the bucket URL.

You should pass a request function that takes two parameters: the url and a callback, and should call the latter with result of making an HTTP GET request to the passed URL.

For example, if you're using Angular, the request function will look something like this:

const request = (url, callback) => {
  $http.get(url).then((response) => {
    return callback(null, response.data);
  }).catch((error) => {
    return callback(error);
  });
};

Kind: Exported function
Summary: Get Etcher latest version
Access: public

Param Type Description
request function HTTP GET request function
callback function callback (error, latestVersion)

Example

const request = require('request');
const etcherLatestVersion = require('etcher-latest-version');
 
etcherLatestVersion((url, callback) => {
  request(url, function(error, response, body) {
    return callback(error, body);
  });
}, (error, latestVersion) => {
  if (error) {
    throw error;
  }
 
  console.log(`The latest version is: ${latestVersion}`);
});

Support

If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.

Tests

Run the test suite by doing:

$ npm test

Contribute

Before submitting a PR, please make sure that you include tests, and that jshint runs without any warning:

$ npm run lint

License

The project is licensed under the Apache 2.0 license.

Readme

Keywords

Package Sidebar

Install

npm i etcher-latest-version

Weekly Downloads

0

Version

1.0.0

License

Apache-2.0

Last publish

Collaborators

  • balena.io