@yaus/m-list

3.0.1 • Public • Published

m-list

An experiment with append only logs (or lists), adhering to the append only log abstract interface and developer API. Currently stores the entire list in memory! Custom storage providers have not been implemented.

usage

var List = require('@yaus/m-list')

// objectMode is true by default
var list = List()

list.append({
  hello: 'world'
}, console.log)

list.append(11)
list.append('hello world!')
list.append([1, 2, 3])

// the sequence number just is the array index plus 1
// so this gets the first item from the list

// async
list.get(1, console.log)

// or syncronously
console.log(list.get(1))

var stream = list.createReadStream()
stream.on('data', console.log)
stream.on('end', console.log)

var list2 = List({ objectMode: false })
list2.append(Buffer.from('stream in binary mode!'))

extra methods

  • toArray()
  • fromArray(array)

install

npm i @yaus/m-list --save

todo

status:: in development

  • allow storage facility to be passed in (RAM, localstorage or custom)
  • toggle cryptographic integrity using a hashchain

Readme

Keywords

Package Sidebar

Install

npm i @yaus/m-list

Weekly Downloads

0

Version

3.0.1

License

MIT

Unpacked Size

12.7 kB

Total Files

7

Last publish

Collaborators

  • yaus