etcher-latest-version v1.0.0
etcher-latest-version
Utility to determine which is the latest published Etcher version
Installation
Install etcher-latest-version by running:
$ npm install --save etcher-latest-versionDocumentation
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 testContribute
- Issue Tracker: github.com/resin-io-modules/etcher-latest-version/issues
- Source Code: github.com/resin-io-modules/etcher-latest-version
Before submitting a PR, please make sure that you include tests, and that jshint runs without any warning:
$ npm run lintLicense
The project is licensed under the Apache 2.0 license.
10 years ago