Bare.js server to proxy HLS video streams
npm install @warren-bank/bare-hls-proxybare-http1.request()~~
bare-https.request()~~
bare-tcp.Server.listen()~~
server.listen(port,
server.listen(port, '0.0.0.0',
bare-http1.ServerResponse.writeHead()~~
streamx.Stream.destroy()~~
javascript
const http = require('bare-http1')
const url = 'http://httpbin.org/headers'
const onresponse = (res) => {
res.setEncoding('utf8')
res.on('data', () => {})
res.on('end', () => {
console.log('request ended', res.statusCode, "\n")
res.destroy()
make_request()
})
}
let remainder = 5
const make_request = () => {
if (remainder <= 0) return
remainder--
console.log('request started')
http.request(url, onresponse).end()
}
make_request()
`
- where:
* res is an instance of bare-http1.IncomingMessage, which inherits from streamx.Stream
* res.destroy === res.socket.destroy === streamx.Stream.destroy
- workaround:
* apply a downstream one-line fix by avoiding the redundant call to res.destroy() from the res.on('end') event listener
* fixed: in v2.1.3 by diff
* ~~streamx.Pipeline.done()~~
- workaround:
* apply a downstream one-line fix here…
`javascript
response.on('error', () => {})
`
* fixed: in v3.6.5 by diff
- - - -
$3
#### How to: Install:
`bash
npm install --global "@warren-bank/bare-hls-proxy"
`
#### How to: Run the server(s):
`bash
bare-hlsd
`
- - - -
$3
#### How to: Install:
`bash
git clone "https://github.com/warren-bank/bare-HLS-Proxy.git"
cd "bare-HLS-Proxy"
npm install
`
#### How to: Run the server(s):
`bash
----------------------------------------------------------------------
If using a port number >= 1024 on Linux, or
If using Windows:
----------------------------------------------------------------------
npm start [-- ]
----------------------------------------------------------------------
https://www.w3.org/Daemon/User/Installation/PrivilegedPorts.html
#
Linux considers port numbers < 1024 to be privileged.
Use "sudo":
----------------------------------------------------------------------
npm run sudo [-- ]
``