mirror of
https://github.com/fluencelabs/dweb-transports
synced 2025-04-25 14:52:18 +00:00
Fix CreateReadStream asychronicity
This commit is contained in:
parent
82a696f51f
commit
13f1302bb4
@ -174,7 +174,7 @@ class TransportHTTP extends Transport {
|
|||||||
if (wanturl) {
|
if (wanturl) {
|
||||||
return url;
|
return url;
|
||||||
} else {
|
} else {
|
||||||
return function (opts) { return self.p_createReadStream(url, opts); };
|
return function (opts) { return self.createReadStream(url, opts); };
|
||||||
}
|
}
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
//Logged by Transports
|
//Logged by Transports
|
||||||
@ -183,7 +183,7 @@ class TransportHTTP extends Transport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async createReadStream(url, opts) {
|
createReadStream(url, opts) {
|
||||||
/*
|
/*
|
||||||
The function, encapsulated and inside another function by p_f_createReadStream (see docs)
|
The function, encapsulated and inside another function by p_f_createReadStream (see docs)
|
||||||
NOTE THIS DOESNT WONT WORK FOR <VIDEO> tags, but shouldnt be using it there anyway - reports stream.on an filestream.pipe aren't functions
|
NOTE THIS DOESNT WONT WORK FOR <VIDEO> tags, but shouldnt be using it there anyway - reports stream.on an filestream.pipe aren't functions
|
||||||
|
@ -188,7 +188,7 @@ class Transports {
|
|||||||
throws: CodingError if urls empty or [undefined ... ]
|
throws: CodingError if urls empty or [undefined ... ]
|
||||||
*/
|
*/
|
||||||
if (!urls.length) throw new errors.TransportError("Transports.p_rawfetch given an empty list of urls");
|
if (!urls.length) throw new errors.TransportError("Transports.p_rawfetch given an empty list of urls");
|
||||||
let resolvedurls = await this.p_resolveNames(urls); // If naming is loaded then convert to a name
|
let resolvedurls = await this.p_resolveNames(urls); // If naming is loaded then convert name to [urls]
|
||||||
if (!resolvedurls.length) throw new errors.TransportError("Transports.p_rawfetch none of the urls resolved: " + urls);
|
if (!resolvedurls.length) throw new errors.TransportError("Transports.p_rawfetch none of the urls resolved: " + urls);
|
||||||
let tt = this.validFor(resolvedurls, "fetch"); //[ [Url,t],[Url,t]] throws CodingError on empty /undefined urls
|
let tt = this.validFor(resolvedurls, "fetch"); //[ [Url,t],[Url,t]] throws CodingError on empty /undefined urls
|
||||||
if (!tt.length) {
|
if (!tt.length) {
|
||||||
|
@ -51,5 +51,5 @@
|
|||||||
"test": "cd src; node ./test.js",
|
"test": "cd src; node ./test.js",
|
||||||
"help": "echo 'test (test it)'; echo 'build (creates dweb-transports-bundle)'"
|
"help": "echo 'test (test it)'; echo 'build (creates dweb-transports-bundle)'"
|
||||||
},
|
},
|
||||||
"version": "0.1.18"
|
"version": "0.1.19"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user