local-update-server

0.0.1 • Public • Published

local-update-server

A tool that creates a local update server, Useful for local testing and such.

Using this tool one defines a version and a download http endpoints, the tool then takes over the domains used (hosts file) and serves the content.

npm status

CLI Tool

npm install -g local-update-server

local-update-server --update-url="http://blablabla.com/version" --update-version="1.2.3" --file="/some/path/to/file" --fileUrl="http://blablabla.com/download"

API

npm install --save local-update-server

var localUpdateServer = require('local-update-server')
var parseUrl = require('url').parse
 
var opts = {
    updateUrl: parseUrl('http://blabla.com:9090/version'),
    fileUrl: parseUrl('http://foobar.com/download'),
    file: '/path/to/file',
    updateVersion: '0.0.1'
}
 
var domains = [opts.fileUrl.hostname, opts.updateUrl.hostname]
 
index.dnsTakeover(domains)
 
process.on('exit', function () {
    index.dnsRemove(domains)
})
 
index.app(opts, function (err) {
    if (err) return console.error(err)
    console.log('ready')
})

license

MIT © Yaniv Kessler

Readme

Keywords

none

Package Sidebar

Install

npm i local-update-server

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • kessler