RubenVerborgh / AsyncIterator

An asynchronous iterator library for advanced object pipelines in JavaScript
https://rubenverborgh.github.io/AsyncIterator/docs/
Other
48 stars 7 forks source link

How can a whole text stream be consumed into a string? #98

Closed namedgraph closed 1 year ago

namedgraph commented 1 year ago

I want to read all data into a string, based on this example: https://comunica.dev/docs/query/advanced/result_formats/#querying-in-a-javascript-app

const result = await myEngine.query(`
  SELECT ?s ?p ?o WHERE {
    ?s ?p <http://dbpedia.org/resource/Belgium>.
    ?s ?p ?o
  } LIMIT 100`, {
  sources: ['http://fragments.dbpedia.org/2015/en'],
});
const { data } = await myEngine.resultToString(result,
  'application/sparql-results+json');
data.pipe(process.stdout); // Print to standard output

How can I do that in the browser?

jeswr commented 1 year ago

Just responded to your question in https://app.element.io/#/room/#comunica_Lobby:gitter.im