mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-13 10:30:03 -04:00
Update util.js
Added support uncompressed XML files
This commit is contained in:
parent
74f029748e
commit
4e471aec2e
1 changed files with 10 additions and 3 deletions
|
@ -139,9 +139,16 @@ function getGzipped(url) {
|
||||||
url: url,
|
url: url,
|
||||||
responseType:'stream'
|
responseType:'stream'
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
var gunzip = zlib.createGunzip()
|
let stream
|
||||||
|
if(res.headers['content-type'] === 'application/xml') {
|
||||||
|
stream = res.data
|
||||||
|
} else {
|
||||||
|
let gunzip = zlib.createGunzip()
|
||||||
res.data.pipe(gunzip)
|
res.data.pipe(gunzip)
|
||||||
gunzip.on('data', function(data) {
|
stream = gunzip
|
||||||
|
}
|
||||||
|
|
||||||
|
stream.on('data', function(data) {
|
||||||
buffer.push(data.toString())
|
buffer.push(data.toString())
|
||||||
}).on("end", function() {
|
}).on("end", function() {
|
||||||
resolve(buffer.join(""))
|
resolve(buffer.join(""))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue