You can find the published source code at github.com/yehn/yehn.
For licensing information, see the attached LICENSE file and the list of third-party licenses at yehn.io/legal/licenses/.
Provider for the following storage engines: File, FileSystem, IndexedDB, Memory & LocalStorage.
One API to rule them all!
Nowadays there are more and more storage possibilities and developers must be familiar with the characteristics of each individual solution to reliably store data. Because it can be sometimes hard to keep up with the highly dynamic world of data storages, we have developed a system which unifies the usage of IndexedDB, In-memory storage, File-based storage and LocalStorage. In addition we built some functionality (like a transient store which deletes data after a TTL) on top.
|Engine||Available in Browser||Available in Node.js||Description|
|FileEngine||🞫||✓||Rudimentary persistent store based on files. Very generic and easy to read.|
|FileSystemEngine||✓||🞫||FileSystem is used to represent a file system which is managed by modern browsers. It is often used to build Chrome Web Store apps.|
|IndexedDBEngine||✓||🞫||Persistent storage which handles significant amounts of structured data, including files/blobs. Enables very fast searches.|
|MemoryEngine||✓||✓||Transient store which loses data on application restart. Suitable for testing environments.|
|LocalStorageEngine||✓||🞫||Can save very small amount of data. Stored data is saved across browser sessions. Suitable for simple objects and strings.|
With an engine you can build a store which has special capabilities like a timeout.
Using a TransientStore
const Store LocalStorageEngine = ;const engine = 'my-favorite-actors';const store = engine;store;
No matter what engine you use, all CRUD operations work the same. 🙂
In the following examples this data is used:
const TABLE_NAME = 'the-simpsons';const PRIMARY_KEY = 'lisa-simpson';const ENTITY = name: 'Lisa Simpson';