🧑🏻🔧 Worker Streams
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
import axios from "axios";
|
||||
import fetch, { Response } from "node-fetch";
|
||||
import {
|
||||
IExtractComicBookCoverErrorResponse,
|
||||
IExtractedComicBookCoverFile,
|
||||
IExtractionOptions,
|
||||
IFolderData,
|
||||
} from "../../server/interfaces/folder.interface";
|
||||
import { FS_API_BASE_URI } from "../constants/endpoints";
|
||||
import { API_BASE_URI } from "../constants/endpoints";
|
||||
|
||||
export async function walkFolder(path: string): Promise<Array<IFolderData>> {
|
||||
return axios
|
||||
.request<Array<IFolderData>>({
|
||||
url: FS_API_BASE_URI + "walkFolder",
|
||||
url: API_BASE_URI + "walkFolder",
|
||||
method: "POST",
|
||||
params: {
|
||||
data: {
|
||||
basePathToWalk: path,
|
||||
},
|
||||
transformResponse: (r: string) => JSON.parse(r),
|
||||
@@ -26,17 +27,16 @@ export async function walkFolder(path: string): Promise<Array<IFolderData>> {
|
||||
export async function extractCoverFromComicBookArchive(
|
||||
extractionOptions: IExtractionOptions,
|
||||
walkedFolders: Array<IFolderData>,
|
||||
): Promise<
|
||||
| IExtractedComicBookCoverFile
|
||||
| IExtractedComicBookCoverFile[]
|
||||
| IExtractComicBookCoverErrorResponse
|
||||
> {
|
||||
return await axios.request({
|
||||
url: FS_API_BASE_URI + "getComicCovers",
|
||||
): Promise<Response> {
|
||||
return await fetch(API_BASE_URI + "getComicCovers", {
|
||||
method: "POST",
|
||||
data: {
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
extractionOptions,
|
||||
walkedFolders,
|
||||
},
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user