🧶 Still WIP on Streaming JSON

This commit is contained in:
2021-05-13 10:32:03 -07:00
parent 01a4835ff8
commit 833c4570e1
3 changed files with 58 additions and 8 deletions

View File

@@ -1,24 +1,28 @@
import router from "../router";
import { Request, Response } from "express";
import axios from "axios";
import { Readable } from "stream";
import stream from "stream";
import through2 from "through2";
import hyperquest from "hyperquest";
import es from "event-stream";
import JSONStream from "JSONStream";
import oboe from "oboe";
router.route("/getComicCovers").post(async (req: Request, res: Response) => {
typeof req.body.extractionOptions === "object"
? req.body.extractionOptions
: {};
const comicBookCoversData = hyperquest.post("http://localhost:3853/api/import/getComicCovers",
{
data: {
oboe({
url: "http://localhost:3000/api/import/getComicCovers",
method: "POST",
body: {
extractionOptions: req.body.extractionOptions,
walkedFolders: req.body.walkedFolders,
},
}).on("node", ".*", (data) => {
console.log(data);
res.write(JSON.stringify(data));
});
console.log(comicBookCoversData.data);
});
router.route("/walkFolder").post(async (req: Request, res: Response) => {