summaryrefslogtreecommitdiff
path: root/pieces/prepare-streams.js
diff options
context:
space:
mode:
Diffstat (limited to 'pieces/prepare-streams.js')
-rw-r--r--pieces/prepare-streams.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/pieces/prepare-streams.js b/pieces/prepare-streams.js
new file mode 100644
index 0000000..0e10e27
--- /dev/null
+++ b/pieces/prepare-streams.js
@@ -0,0 +1,36 @@
+const fs = require("fs");
+// const https = require("https");
+var request = require('request-promise');
+
+var calls = [
+ request({
+ url: 'https://storage.googleapis.com/pythia-files/uploads/json/emarket-keywords.json',
+ // headers: { ... }
+ }),
+ request({
+ url: 'https://storage.googleapis.com/pythia-files/uploads/json/emarket-products.json',
+ // headers: { ... }
+ }),
+ // + linked-terms and replaces
+ // and more..
+];
+
+Promise.all(calls).then(function(results) {
+ // do something with results[0]
+ // do something with results[1]
+ // ...
+});
+
+
+
+// write files into local fs; use them cached
+
+let file = fs.createWriteStream("data.txt");
+
+https.get("https://www.w3.org/TR/PNG/iso_8859-1.txt", response => {
+ var stream = response.pipe(file);
+
+ stream.on("finish", function() {
+ console.log("done");
+ });
+}); \ No newline at end of file