Use undici fetch

This commit is contained in:
SukkaW
2025-01-10 00:50:54 +08:00
parent 0c679645e7
commit 5e40f2cbe0
8 changed files with 22 additions and 23 deletions

View File

@@ -8,8 +8,8 @@ import { TextLineStream } from './text-line-transform-stream';
import type { ReadableStream } from 'node:stream/web';
import { TextDecoderStream } from 'node:stream/web';
import { processLine, ProcessLineStream } from './process-line';
import { $fetch } from './make-fetch-happen';
import type { NodeFetchResponse } from './make-fetch-happen';
import { $$fetch } from './fetch-retry';
import type { UndiciResponseData } from './fetch-retry';
import type { Response as UnidiciWebResponse } from 'undici';
@@ -70,7 +70,7 @@ export const createReadlineInterfaceFromResponse: ((resp: NodeFetchResponse | Un
};
export function fetchRemoteTextByLine(url: string, processLine = false): Promise<AsyncIterable<string>> {
return $fetch(url).then(resp => createReadlineInterfaceFromResponse(resp, processLine));
return $$fetch(url).then(resp => createReadlineInterfaceFromResponse(resp, processLine));
}
export async function readFileIntoProcessedArray(file: string /* | FileHandle */) {