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
Merge pull request #303 from apifytech/feature/queue_kvstore_fixexz
Ondra Urban3d77672581b2
diff --cc src/key_value_store.jsindex d76695e4b,43a066679..f7fda5109--- a/src/key_value_store.js+++ b/src/key_value_store.js@@@ -408,34 -414,16 +415,36 @@@ export class KeyValueStoreLocalcheckParamOrThrow(exclusiveStartKey, 'options.exclusiveStartKey', 'Maybe String');checkParamOrThrow(index, 'index', 'Number');+ await this.initializationPromise;+const files = await readdirPromised(this.localStoragePath);- let keys = files.map(file => path.parse(file).name).sort(); // Array is sorted to emulate API.+ let keys = [];+ for (const file of files) {+ try {+ const { size } = await statPromised(this._getPath(file));+ keys.push({+ key: path.parse(file).name,+ info: { size },+ });+ } catch (e) {+ if (e.code !== 'ENOENT') {+ throw e;+ }+ }+ }++ keys = keys.sort((a, b) => {+ if (a.key < b.key) return -1;+ if (a.key > b.key) return 1;+ return 0;+ }); // Array is sorted to emulate API.+if (exclusiveStartKey) {- const keyPos = keys.indexOf(exclusiveStartKey);+ const keyPos = keys.findIndex(item => item.key === exclusiveStartKey);if (keyPos !== -1) keys = keys.slice(keyPos + 1);}- for (const key of keys) {- await iteratee(key, index++);+ for (const item of keys) {+ await iteratee(item.key, index++, item.info);}}