This library provides core types for paging async iterable iterators.
If using this as part of another project in the azure-sdk-for-js repo,
then run rush install
after cloning the repo.
Otherwise, use npm to install this package in your application as follows
npm install @azure/core-paging
You can find an explanation of how this repository's code works by going to our architecture overview.
Example of building with the types:
public listSecrets(
options: ListSecretsOptions = {}
): PagedAsyncIterableIterator<SecretAttributes> {
const iter = this.listSecretsAll(options);
return {
async next() { return iter.next(); },
[Symbol.asyncIterator]() { return this; },
byPage: (settings: PageSettings = {}) => this.listSecretsPage(settings, options),
};
}
And using the types:
for await (let page of client.listSecrets().byPage({ maxPageSize: 2 })) {
for (const secret of page) {
console.log("secret: ", secret);
}
}
Try out this package in your application when dealing with async iterable iterators and provide feedback!
Log an issue at https://github.com/Azure/azure-sdk-for-js/issues
If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.