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.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
feat: add `set` and `useStorageClient` shortcut to `Configuration`
Martin Adámek2e66fa2fad84
diff --git a/packages/core/src/configuration.ts b/packages/core/src/configuration.tsindex dcd522c83..a1b66f120 100644--- a/packages/core/src/configuration.ts+++ b/packages/core/src/configuration.ts@@ -349,6 +349,14 @@ export class Configuration {this.options.set(key, value);}+ /**+ * Sets value for given option. Only affects the global `Configuration` instance, the value will not be propagated down to the env var.+ * To reset a value, we can omit the `value` argument or pass `undefined` there.+ */+ static set(key: keyof ConfigurationOptions, value?: any): void {+ this.getGlobalConfig().set(key, value);+ }+/*** Returns cached instance of {@apilink StorageClient} using options as defined in the environment variables or in* this {@apilink Configuration} instance. Only first call of this method will create the client, following calls will@@ -407,6 +415,10 @@ export class Configuration {this.options.set('storageClient', client);}+ static useStorageClient(client: StorageClient): void {+ this.getGlobalConfig().useStorageClient(client);+ }+useEventManager(events: EventManager): void {this.options.set('eventManager', events);}