JSPM

  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q40757F
  • License MIT

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

Package Exports

  • resolve-snapshot-lite

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (resolve-snapshot-lite) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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