Adding streaming JSON support to endpoint

This commit is contained in:
2021-05-11 22:07:14 -07:00
parent 6c12700957
commit aa9927d5c5
3 changed files with 87 additions and 11880 deletions

View File

@@ -10,7 +10,12 @@ import {
IExtractionOptions,
IFolderData,
} from "../interfaces/folder.interface";
import axios from "axios";
import { Readable } from "stream";
import through2 from "through2";
import oboe from "oboe";
import H from "highland";
import { stringify } from "highland-json";
export default class ProductsService extends Service {
// @ts-ignore
public constructor(public broker: ServiceBroker, schema: ServiceSchema<{}> = {}) {
@@ -54,11 +59,12 @@ export default class ProductsService extends Service {
walkedFolders: IFolderData[];
}>
) {
return await getCovers(
const comicBookCoversData = await getCovers(
ctx.params.extractionOptions,
ctx.params.walkedFolders
);
return H(comicBookCoversData)
.through(stringify);
},
},
},