changes
This commit is contained in:
@@ -3,10 +3,11 @@ import {
|
||||
extractCoverFromComicBookArchive,
|
||||
} from "../actions/fileops.actions";
|
||||
import { IExtractedComicBookCoverFile } from "../../server/interfaces/folder.interface";
|
||||
const ndjsonStream = require("can-ndjson-stream");
|
||||
|
||||
export const greet = async (
|
||||
path: string,
|
||||
): Promise<IExtractedComicBookCoverFile[] | unknown> => {
|
||||
): Promise<IExtractedComicBookCoverFile[] | unknown | any> => {
|
||||
const targetOptions = {
|
||||
sourceFolder: path,
|
||||
extractTarget: "all",
|
||||
@@ -27,5 +28,16 @@ export const greet = async (
|
||||
},
|
||||
fileObjects,
|
||||
);
|
||||
return JSON.stringify(fo);
|
||||
const reader = await ndjsonStream(fo).getReader();
|
||||
reader.read().then(function process({ done, value }) {
|
||||
if (done) {
|
||||
console.log("done");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(value);
|
||||
|
||||
return reader.read().then(process);
|
||||
});
|
||||
// return JSON.stringify(fo);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user