Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
80 views

How do I get this working in TypeScript? Here is the EventIterator library, which seems to make it possible to build a queue to handle the callbacks of the xhr progress event nicely. import { ...
Lance Pollard's user avatar
1 vote
1 answer
94 views

I just isolated a strange behavior I've observed, but now I'm out of ideas. My script asynchronously iterates over the stdout stream of a process which has been spawned via ssh (asyncssh) in a kind of ...
frans's user avatar
  • 9,978
2 votes
0 answers
804 views

Problem I am using @aws-sdk/client-s3 - 3.414.0, and its SelectObjectContentCommand returning an S3 Select result as AsyncIterable<SelectObjectContentEventStream>. I am trying to then parse this ...
Tom's user avatar
  • 21
2 votes
0 answers
437 views

I'm migrating some old aws-sdk v2 code to the new v3 and found some pretty neat new paginator logic. I wanted to use that but am having trouble unit testing it which is making this process take much ...
ghidalgo's user avatar
-1 votes
2 answers
287 views

reading the first n bytes of a byte stream (in form of a AsyncIterable) feels cumbersome and error prone. Is there a better way to implement this? async function shift( length: number, stream: ...
Max Fichtelmann's user avatar
0 votes
1 answer
1k views

I am trying to select a CSV file with some columns and data using file input. This is the content of the CSV id,level,cvss,title,Vulnerability,Solution,reference, 963,LOW,7.8,Title - 963,Vulnerability ...
user avatar
1 vote
1 answer
1k views

Is it safe/bad practice to make a class both iterator and async iterator? Example: import asyncio class Iter: def __init__(self): self.i = 0 self.elems = list(range(10)) ...
AntonPeganov's user avatar
6 votes
4 answers
2k views

Scenario I'm given a function with an asynchronous callback like let readFile: (path: string, callback: (line: string, eof: boolean) => void) => void Though I would prefer a function using ...
Mal's user avatar
  • 385
2 votes
1 answer
2k views

I currently have a function, which yields results from an external source, which may arrive over a long time period. async def run_command(data): async with httpx.AsyncClient() as client: ...
Maikol's user avatar
  • 357
1 vote
2 answers
567 views

So Deno has a filesystem watcher API that seems... obtuse to me. Perhaps that's simply due to my ignorance of async iterators. It's shown to be used like so: const watcher = Deno.watchFs("/...
Chris_F's user avatar
  • 5,864
1 vote
1 answer
908 views

I'm making a GraphQL backend in Apollo, and I'd like to use subscriptions. I followed Apollo's docs, and I've gotten basic subscriptions working using graphql-subscriptions. This package also comes ...
Atlinx's user avatar
  • 634
3 votes
1 answer
768 views

I've successfully got graphQL subscriptions to work with help of the documentation. The subscription returns a pubsub.asyncIterator("MY_TOPIC"), which I then can send messages trough. Now I ...
engelant's user avatar
  • 143
1 vote
2 answers
8k views

I copied an async sleep function from here https://stackoverflow.com/a/39914235/7492244 Then I used it basically in this program. https://nodejs.org/api/readline.html#example-read-file-stream-line-by-...
Ploppz's user avatar
  • 144
3 votes
1 answer
286 views

I'm currently trying to use IPFS with Kotlin/JS, though my problem isn't specific to that. The ipfs.cat() and ipfs.get() functions return an AsyncGenerator and I'm unsure how to iterate over it with ...
Minmo's user avatar
  • 143
4 votes
1 answer
2k views

MDN states that async iterators have a return method const asyncIterable = { [Symbol.asyncIterator]() { let i = 0; return { next() { const done = i === LIMIT; const ...
Foobar's user avatar
  • 8,659
3 votes
1 answer
703 views

With mongodb in node we can use async iterators. Basic example: const documents: Record<string, any>[] = []; let cursor = db.collection('randomcollection').find(); for await (let doc of cursor) ...
florian norbert bepunkt's user avatar
10 votes
4 answers
6k views

Let's say we have an async generator: exports.asyncGen = async function* (items) { for (const item of items) { const result = await someAsyncFunc(item) yield result; } } is it possible to ...
Dmitry Kankalovich's user avatar
0 votes
1 answer
1k views

I use graphql nodejs with apollo-server. When i try i got this error: I already i returns pubsub.asyncIterator in resolver. It returns error. Another project same setting works but there it is not ...
rufai demir's user avatar
1 vote
0 answers
276 views

I'm looking for a way, using build in function if that's possible, to convert async generator into array in JavaScript. Example that work with generator: function* foo() { for (let x = 0; x < ...
jcubic's user avatar
  • 67.1k
1 vote
0 answers
127 views

What is purpose of iteratorCount in the following code (from https://deno.land/[email protected]/async/mux_async_iterator.ts)? #iteratorCount = 0 #yields = [] #throws = [] #signal = deferred() add () { ++...
kwonryul's user avatar
  • 565
7 votes
3 answers
3k views

This is part of a larger process that I've distilled down to the minimal, reproducible example in node v14.4.0. In this code, it outputs nothing from inside the for loop. I see only this output in ...
jfriend00's user avatar
  • 711k
4 votes
1 answer
3k views

I'm writing an AWS Lambda function in TypeScript using the Node.js runtime. I'm using a "batchDelete" function from a DynamoDB ORM library which returns an AsyncIterableIterator type. ...
Gambit's user avatar
  • 296
0 votes
0 answers
540 views

I am using this library https://www.npmjs.com/package/event-iterator to use async iterators. I have the following function export function grpcClientReadableStreamToAsyncIterator<T>( stream: ...
kosta's user avatar
  • 4,830
5 votes
3 answers
4k views

I've been playing around with async generators in an attempt to make a "promise ordering" generator which takes an array of promises and yields out promises one by one in the order they resolve or ...
CRice's user avatar
  • 32.6k
1 vote
1 answer
78 views

I'm trying to replicate Brett Camper's code about streaming GeoJSONL files, and it is quite complex. I'm trying to understand what it does step by step, but I really can't figure out what this syntax ...
epilurzu's user avatar
  • 147
1 vote
0 answers
951 views

I'm studying Async iterators and generators from this wonderful page, but when I try to use the following "simple" code... // Note the * after "function" async function* asyncRandomNumbers() { ...
epilurzu's user avatar
  • 147
1 vote
0 answers
117 views

What I want to do is probably easy, but after working on this for awhile the implementation that I came up with is a little complicated. This is what I want to do: I want to be able to create a ...
stackhatter's user avatar
3 votes
3 answers
2k views

Right now I have the following code: import axios from 'axios' const urls = ['https://google.com', 'https://yahoo.com'] async function* requests() { for (const url of urls) { yield axios.get(...
user avatar
7 votes
2 answers
5k views

Based on the example of processLineByLine() I noticed that we cannot catch the error if the given filename does not exist. In that case the program finishes with something like: ...
Miguel Gamboa's user avatar
3 votes
1 answer
18k views

Consider this basic AsyncIterator Example from MDN: var asyncIterable = { [Symbol.asyncIterator]() { return { i: 0, next() { if (this.i < 3) { return Promise....
panepeter's user avatar
  • 4,342
0 votes
1 answer
691 views

I found plenty of walkers on npm but none is using an asynchronous iterator. Most of them are either using a callback or a promise leading to memory leaks on huge directories. Is there any recent ...
Flavien Volken's user avatar
1 vote
4 answers
4k views

I'm somewhat new to Node.js libraries and I'm trying figure how to use async iteration over an HTTP response stream. My overall goal is to read a large response stream and process it as chunks arrive,...
Steve Guidi's user avatar
  • 20.3k
8 votes
3 answers
8k views

I am trying to understand javascript's Symbol.asyncIterator and for await of. I wrote some simple code and it throws an error saying: TypeError: undefined is not a function on the line which ...
Suhail Gupta's user avatar
  • 23.4k
1 vote
1 answer
251 views

In the function testMultipleLoops2 after the first for await, l will turn to GeneratorStatus:<closed>, I've done huge research but didn't find a method to reopen it. const tryRecursive=...
a_a's user avatar
  • 271
1 vote
1 answer
100 views

I've got a curried batching function that returns an Iterable. If you call it with a sync Iterable you get a sync Iterable, if you give an AsyncIterable you get an AsyncIterable. But can't for the ...
reconbot's user avatar
  • 5,317
0 votes
1 answer
647 views

I am following this guide. I am trying to listen to a graphQL subscription in my node app. I am having a lot of trouble implementing that subscription. I have a tried a few different ways, listed ...
prolink007's user avatar
  • 34.7k
4 votes
1 answer
2k views

Say I have the following function async def f1(): async for item in asynciterator(): return What happens to the async iterator after await f1() ? Should I worry about cleaning up or will ...
Liviu's user avatar
  • 1,103
1 vote
1 answer
614 views

I'm playing with some new JavaScript features like async/await and generators. I have function readPages with signature async function* readPages(....): AsyncIterableIterator<string> {} and I ...
Matěj Pokorný's user avatar
0 votes
0 answers
112 views

I would like to know some possible real world usage examples of asynchronous iterators, part of ECMAScript 2018. For readable streams it looks useful, since we would be able to iterate them easily ...
Antonio Val's user avatar
  • 3,370
2 votes
2 answers
2k views

Error Log On initiating application While initiating the application it shows the following error and i tried couple of fixes from online which has mentioned below but none of them has worked ...
Rigin Oommen's user avatar
  • 3,395
2 votes
1 answer
1k views

So I get Promise<AsyncIterableIterator<T>> and I need plain AsyncIterableIterator<T> how can I unwrap the AsyncIterableIterator<T> from under the promise?
Trident D'Gao's user avatar
6 votes
3 answers
2k views

Lets say I have a generator: function* source() { yield "hello"; yield "world"; } I create the iterable, iterate with a for-loop, and then break out of the loop before the iterator fully completes ...
Meirion Hughes's user avatar