https://github.com/kessler/node-local-update-server
A tool that creates a local update server
https://github.com/kessler/node-local-update-server
Last synced: about 2 months ago
JSON representation
A tool that creates a local update server
- Host: GitHub
- URL: https://github.com/kessler/node-local-update-server
- Owner: kessler
- Created: 2015-12-12T07:20:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-12T07:26:12.000Z (over 9 years ago)
- Last Synced: 2025-03-08T08:12:40.526Z (about 2 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# 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.
[](https://www.npmjs.org/package/update-mock-server)
## CLI Tool
`npm install -g local-update-server`
```bash
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````javascript
var localUpdateServer = require('local-update-server')
var parseUrl = require('url').parsevar 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](http://opensource.org/licenses/MIT) © Yaniv Kessler