parent
29c5dc921f
commit
c47e9fdd0b
|
@ -132,6 +132,8 @@ async function loadEPG(url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGzipped(url) {
|
function getGzipped(url) {
|
||||||
|
const supportedTypes = ['application/x-gzip', 'application/octet-stream']
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
var buffer = []
|
var buffer = []
|
||||||
axios({
|
axios({
|
||||||
|
@ -140,12 +142,12 @@ function getGzipped(url) {
|
||||||
responseType:'stream'
|
responseType:'stream'
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
let stream
|
let stream
|
||||||
if(res.headers['content-type'] === 'application/xml') {
|
if(supportedTypes.indexOf(res.headers['content-type']) > -1) {
|
||||||
stream = res.data
|
|
||||||
} else {
|
|
||||||
let gunzip = zlib.createGunzip()
|
let gunzip = zlib.createGunzip()
|
||||||
res.data.pipe(gunzip)
|
res.data.pipe(gunzip)
|
||||||
stream = gunzip
|
stream = gunzip
|
||||||
|
} else {
|
||||||
|
stream = res.data
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.on('data', function(data) {
|
stream.on('data', function(data) {
|
||||||
|
|
Loading…
Reference in New Issue