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.

Updated README.md

Jan Curn4fca8b99b49c
diff --git a/README.md b/README.md
index 0cbee2972..b5fd7641e 100644
--- a/README.md
+++ b/README.md
@@ -11,14 +11,59 @@ This package is still a work in progress, stay tuned.
npm install apifier --save
```
+## Usage inside acts
-## Usage
+Import the package to your source code
+
+```
+const Apifier = require('apifier');
+```
+
+And use `Apifier.main(func)` to pass a user function that will be invoked by the Apifier actor runtime.
+
+```
+Apifier.main( (options) => {
+ // my synchronous function that returns immediatelly
+ console.dir(`Received: ${options.input}`);
+ return 'Hello world from actor!';
+});
+```
+
+If the user function returns a promise, it is considered as asynchronous.
+
+```
+Apifier.main( (options) => {
+ // my asynchronous function that returns a promise
+ console.dir(`Received: ${options.input}`);
+ return Promise.resolve()
+ .then(()=>{
+ // do something here
+ })
+ .then(()=>{
+ return 'Hello world from asynchronous actor!';
+ });
+});
+```
+
+The user function has a single argument `options` which is an object such as:
+```
+{
+ input: Object, // HTTP payload parsed as JSON (if possible) or as text
+}
+```
+
+
+
+
+
+## Package maintenance
* `npm run test` to run tests
* `npm run test-cov` to generate test coverage
* `npm run build` to transform es6/es7 to es5 by Babel
* `npm run clean` to clean `build/` directory
* `npm run lint` to lint js using ESLint in Airbnb's Javascript style
+* `npm publis` to run Babel, run tests and publish the package to NPM
## License