INNER CODE UNIT · JavaScript

Batch

Level/levelup · lib/batch.js:8

function Batch (levelup) {
  this.db = levelup
  this.batch = levelup.db.batch()
  this.ops = []
  this.length = 0
}

Batch.prototype.put = function (key, value, options) {
  try {
    this.batch.put(key, value, options)
  } catch (e) {
    throw new WriteError(e)
  }

  this.ops.push({ ...options, type: 'put', key, value })
  this.length++

  return this

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…