Skip to content

Getting started

Noah edited this page Oct 6, 2019 · 2 revisions

Streamlet is a "Flat File Database" that takes advantage of JS Streams

An example program implementing streamlet with an Express application might look similar to this:

const app = require('express')()
const streamlet = require('streamlet')
const path = require('path')

const config = {
  port: "3000"
  dbPath: path.join(__dirname, "db.sl")
}

let db = new streamlet(config.dbPath)

app.listen(config.port, async () => {
  await db.init()
  // Rest of your Application
})

Ensure that before any operations on the database are done that await db.init() this will open an append stream on the file noted in config.dbPath

Clone this wiki locally