resolve-snapshot-lite

An adapter used to save snapshots to a file or in memory.

Usage no npm install needed!

<script type="module">
  import resolveSnapshotLite from 'https://cdn.skypack.dev/resolve-snapshot-lite';
</script>

README

resolve-snapshot-lite

npm version

This package is an adapter for storing snapshots using a file or memory. It does not have binary dependencies and does not require additional applications (like MongoDB or SQL server).

Available Parameters

  • bucketSize - the bucket size.
  • databaseFile - the path to a file where snapshots are stored. Notice, if that argument is not passed the adapter uses memory to store snapshots. In this case, all data is lost when an application instance is restarted.

Usage

import createSnapshotAdapter from 'resolve-snapshot-lite'

const snapshotAdapter = createSnapshotAdapter({
  databaseFile: 'path/to/file',
  bucketSize: 100
})

await snapshotAdapter.loadSnapshot(key)
await snapshotAdapter.saveSnapshot(key, value)
await snapshotAdapter.dispose({ dropSnapshots: true })

Analytics