{"id":47396,"library":"dexie-batch","title":"Dexie Batch","description":"Dexie Batch (v0.4.3) is a utility library for Dexie.js that fetches IndexedDB entries in configurable batch sizes to improve performance and avoid 'Maximum IPC message size exceeded' errors in browser environments. It provides two iteration methods: each (process individual items) and eachBatch (process batches). Batches are fetched in parallel when a limit is specified, otherwise serially. Last updated in 2021, stable release, minimal API surface with clear documentation. Differentiator: solves IPC size limits specific to Dexie/IndexedDB, not generic batch processing.","status":"active","version":"0.4.3","language":"javascript","source_language":"en","source_url":"https://github.com/raphinesse/dexie-batch","tags":["javascript","batch","bulk","dexie","fetch","get"],"install":[{"cmd":"npm install dexie-batch","lang":"bash","label":"npm"},{"cmd":"yarn add dexie-batch","lang":"bash","label":"yarn"},{"cmd":"pnpm add dexie-batch","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; DexieBatch requires Dexie.js (v >1.3.6) to interact with IndexedDB tables and collections.","package":"dexie","optional":false}],"imports":[{"note":"ESM default export; CommonJS require works but is not recommended.","wrong":"const DexieBatch = require('dexie-batch')","symbol":"DexieBatch","correct":"import DexieBatch from 'dexie-batch'"},{"note":"Options must be passed as an object; batchSize is required.","wrong":"const batch = new DexieBatch(10, 100)","symbol":"DexieBatch (constructor)","correct":"const batch = new DexieBatch({ batchSize: 10, limit: 100 })"},{"note":"Method expects a Dexie.Collection, not a Table.","wrong":"batch.each(table, callback)","symbol":"batch.each","correct":"batch.each(collection, (item, idx) => { ... })"},{"note":"Callback receives array of items (the batch) and batch index.","wrong":"","symbol":"batch.eachBatch","correct":"batch.eachBatch(collection, (batch, batchIdx) => { ... })"}],"quickstart":{"code":"import Dexie from 'dexie';\nimport DexieBatch from 'dexie-batch';\n\nconst db = new Dexie('MyDatabase');\ndb.version(1).stores({ friends: '++id, name, age' });\n\nasync function processFriends() {\n  await db.friends.bulkAdd([\n    { name: 'Alice', age: 30 },\n    { name: 'Bob', age: 25 },\n    { name: 'Charlie', age: 35 }\n  ]);\n\n  const collection = db.friends.where('age').above(20).toCollection();\n  const batchDriver = new DexieBatch({ batchSize: 2, limit: 10 });\n\n  await batchDriver.each(collection, (friend, index) => {\n    console.log(`Processing friend: ${friend.name}`);\n  });\n  console.log('All done!');\n}\n\nprocessFriends().catch(console.error);","lang":"javascript","description":"Creates a Dexie database with 'friends' table, adds sample data, then fetches records in batches of 2 using DexieBatch.each."},"warnings":[{"fix":"Use 'each' or 'eachBatch' instead.","message":"The 'eachKey' and 'eachUniqueKey' methods are not implemented and will throw if called.","severity":"deprecated","affected_versions":">=0.4.0"},{"fix":"Provide a 'limit' if parallel batch fetching is desired.","message":"When no 'limit' option is provided, batches are fetched serially (one after another).","severity":"gotcha","affected_versions":">=0.4.0"},{"fix":"Always pass { batchSize: <number> } to the constructor.","message":"The 'batchSize' option is mandatory; omitting it will cause a runtime error.","severity":"gotcha","affected_versions":">=0.4.0"},{"fix":"Ensure you use Dexie.Promise polyfill or adjust limit usage; check documentation.","message":"Dexie 3.x dropped built-in Promise; the 'isParallel' method may return false for valid parallel scenarios.","severity":"breaking","affected_versions":">=0.4.0 with Dexie >=3.0"}],"env_vars":null,"search_vec":"'2021':62 'api':66 'avoid':24 'batch':2,4,18,46,47,81,84 'browser':32 'bulk':85 'clear':69 'configur':17 'dexi':1,3,86 'dexie.js':11 'dexie/indexeddb':78 'differenti':71 'document':70 'eachbatch':44 'entri':15 'environ':33 'error':30 'exceed':29 'fetch':13,49,87 'generic':80 'get':88 'improv':21 'indexeddb':14 'individu':41 'ipc':26,73 'item':42 'iter':37 'javascript':83 'last':59 'librari':9 'limit':54,75 'maximum':25 'messag':27 'method':38 'minim':65 'otherwis':57 'parallel':51 'perform':22 'process':40,45,82 'provid':35 'releas':64 'serial':58 'size':19,28,74 'solv':72 'specif':76 'specifi':56 'stabl':63 'surfac':67 'two':36 'updat':60 'util':8 'v0.4.3':5","created_at":"2026-06-07T16:51:18.659579+00:00","updated_at":"2026-06-07T16:51:18.659579+00:00","problems":[{"fix":"Pass a positive integer as batchSize, e.g., new DexieBatch({ batchSize: 25 }).","cause":"The 'batchSize' option was omitted or set to an invalid value.","error":"Uncaught (in promise) Error: batchSize must be a positive integer"},{"fix":"Use 'each' or 'eachBatch' instead.","cause":"Calling the non-existent 'eachKey' method.","error":"Error: eachKey is not implemented"},{"fix":"Call 'toCollection()' on the table first, e.g., db.friends.toCollection()","cause":"Passing a Table instance instead of a Collection to the batch methods.","error":"TypeError: collection.toCollection is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/raphinesse/dexie-batch#readme","github":"https://github.com/raphinesse/dexie-batch","docs":null,"changelog":null,"pypi":null,"npm":"dexie-batch","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}