-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for AsyncIterator #132
Comments
Hi @Modeeeeeee do you have time to do a PR, I can help out with the testing? |
@soulgalore I will take a look in the next couple of hours |
@soulgalore #133. Added a dummy test but you can adjust it yourself to your liking |
@soulgalore Any update on this ? |
Sorry I haven't had time. There's been an issue with Firefox 132 running in Docker in another project that takes my time until it's solved. |
@soulgalore just a weekly check if there is no updates |
Currently, the
harFromMessages
function in thechrome-har
module does not support asynchronous iteration usingfor await...of
. This limitation makes it difficult to process asynchronous streams of messages efficiently.I would like to request adding support for
for await...of
to theharFromMessages
function so that it can accept anAsyncIterator
. This would allow users to process asynchronous streams of messages more efficiently.As an alternative, users can manually collect all messages into an array before passing them to
harFromMessages
. However, this approach is not efficient for large streams of messages and can lead to high memory usage.Here is an example of how the updated
harFromMessages
function could look with support forAsyncIterator
:async function harFromMessages(messages, options) {
options = Object.assign({}, defaultOptions, options);
const ignoredRequests = new Set(),
rootFrameMappings = new Map();
let pages = [],
entries = [],
entriesWithoutPage = [],
responsesWithoutPage = [],
paramsWithoutPage = [],
responseReceivedExtraInfos = [],
currentPageId;
for await (const message of messages) {
// Process each message
console.log(message);
}
// Rest of the function logic
}
module.exports = { harFromMessages };
The text was updated successfully, but these errors were encountered: