Transactional Log
Safely and reliable serialize and write data to a file in transactions, and read them back again
Installation
npm install --save data-transactional-log
Usage
; ; // Each log is composed of transactions. Each transaction is simply a list of values of the same time.await log.writeTransaction ; // In many cases we might want to create transactions with only one item. For that we can use the shortcut methodawait log.write 1 ; // The methods above are fine when we have the transaction's items upfront, but sometimes we do not. For that we can explicitly create a transaction; try catch // After having written to a log, we can retrieve those transactionsfor await of transaction.readTransactions // Sometimes we might not necessarily care about the transactions themselves, and just need the actual datafor await of transaction.read // For convenience, we might need the last transaction read. For that we haveconsole.log transaction.lastTransactionRead ;console.log transaction.lastTransactionIdRead ;