Skip to content

Commit

Permalink
Use Readable from readable-stream
Browse files Browse the repository at this point in the history
  • Loading branch information
surilindur committed Mar 21, 2024
1 parent b0d06e7 commit 9e012e8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/SparqlEndpointFetcher.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { Readable } from 'node:stream';
import type * as RDF from '@rdfjs/types';
import * as isStream from 'is-stream';
import { StreamParser } from 'n3';
import { Readable as ReadableStreamReadable } from 'readable-stream';
import { Readable } from 'readable-stream';
import { type InsertDeleteOperation, type ManagementOperation, Parser as SparqlParser } from 'sparqljs';
import { type ISettings as ISparqlJsonParserArgs, SparqlJsonParser } from 'sparqljson-parse';
import { type ISettings as ISparqlXmlParserArgs, SparqlXmlParser } from 'sparqlxml-parse';
Expand Down Expand Up @@ -143,7 +142,7 @@ export class SparqlEndpointFetcher {
query,
SparqlEndpointFetcher.CONTENTTYPE_TURTLE,
);
return responseStream.pipe(new StreamParser({ format: contentType }));
return <Readable & RDF.Stream> <unknown> responseStream.pipe(new StreamParser({ format: contentType }));
}

/**
Expand Down Expand Up @@ -247,7 +246,7 @@ export class SparqlEndpointFetcher {
responseStream = <NodeJS.ReadableStream> <unknown> httpResponse.body;
} else {
const httpResponseBodyReader = httpResponse.body.getReader();
const convertedStream = new ReadableStreamReadable();
const convertedStream = new Readable();
convertedStream._read = () => {
httpResponseBodyReader.read()
.then(data => convertedStream.push(data.done ? null : data.value))
Expand Down

0 comments on commit 9e012e8

Please sign in to comment.