Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Improve forEach examples in docs

Ondra Urban50d554cd4ada
diff --git a/src/dataset.js b/src/dataset.js
index 08f910f24..f9121d367 100644
--- a/src/dataset.js
+++ b/src/dataset.js
@@ -291,7 +291,7 @@ export class Dataset {
* **Example usage**
* ```javascript
* const dataset = await Apify.openDataset('my-results');
- * dataset.forEach(async (item, index) => {
+ * await dataset.forEach(async (item, index) => {
* console.log(`Item at ${index}: ${JSON.stringify(item)}`);
* });
* ```
diff --git a/src/key_value_store.js b/src/key_value_store.js
index e3ccc9a38..f392e6a42 100644
--- a/src/key_value_store.js
+++ b/src/key_value_store.js
@@ -314,7 +314,7 @@ export class KeyValueStore {
* **Example usage**
* ```javascript
* const keyValueStore = await Apify.openKeyValueStore();
- * keyValueStore.forEachKey(async (key, index, info) => {
+ * await keyValueStore.forEachKey(async (key, index, info) => {
* console.log(`Key at ${index}: ${key} has size ${info.size}`);
* });
* ```