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.

Improved Apify.main() docs

Jan Curn5eb2f52f47cc
diff --git a/src/actor.js b/src/actor.js
index 8c45c897d..dd04b7630 100644
--- a/src/actor.js
+++ b/src/actor.js
@@ -156,12 +156,15 @@ export const getEnv = () => {
};
/**
- * Runs the main user function that performs the job of the actor.
+ * Runs the main user function that performs the job of the actor
+ * and terminates the process when the user function finishes.
*
- * `Apify.main()` is especially useful when you're running your code in an actor on the Apify platform.
- * Note that its use is optional - the function is provided merely for your convenience.
+ * *The `Apify.main()` function is optional* and is provided merely for your convenience.
+ * It is especially useful when you're running your code as an actor on the [Apify platform](https://apify.com/actors).
+ * However, if you want to use Apify SDK tools directly inside your existing projects or outside of Apify platform,
+ * it's probably better to avoid it since it terminates the main process.
*
- * The function performs the following actions:
+ * The `Apify.main()` function performs the following actions:
*
* <ol>
* <li>When running on the Apify platform (i.e. <code>APIFY_IS_AT_HOME</code> environment variable is set),