bee-transaction

1.0.0 • Public • Published

bee-transaction

Automatic batch for Hyperbee

npm i bee-transaction

Usage

It creates a batch, locks, gives you a callback to use it, and flushes or closes if any error.

const beeTransaction = require('bee-transaction')

const db = new Hyperbee(...)

const id = await beeTransaction(db, async function (b) {
  const userId = 1

  await b.put('/users/' + userId, { email, password })
  await b.put('/index/email/' + email, userId)

  return userId
})

console.log(id) // => 1

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i bee-transaction

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.96 kB

Total Files

6

Last publish

Collaborators

  • lukks