It uses localStorage, indexedDB, and webSQL backends as key-value store database to store data locally in the web browser. It wraps all of them using a fast, cross-browser localStorage-like API and stores a very wide range of data types in the most optimal way possible, everywhere.
It uses all the available web storage backends. If one is full, it automatically stores in another.
It checks the data type, and then chooses the one that offers the best functionality, which makes fridge the first of its kind.
Why use fridge?
Web browsers provides many ways to store data locally in the browser, but it's very complicated, there are many headaches, many bugs, some has limited storage support, some has broken buggy implementations, and they all come with limitations, you can't store this and you can't store that. Even professional web developers struggle in this.
There are many web storage libraries that solve these issues, but very large in size, and they don't have the luxury of using the optimal storage based on data type, which makes them slower than fridge, such as localForage. And some provides wrappers around certain storage technology, but with bugs, and requires storage polyfills. If you want to store an image or an audio file, you have to use a very big library to do a simple job.
For these reasons, JaguarScript built fridge.js, an extremely lightweight and production-ready replacement for localStorage and localForage. It's fast, the lightest multi-backend storage ever made, perfect for mobile, cross-browser, and it does the offline web storage job perfectly.
The World's lightest multi-backend web storage library on the planet. It's just 7.8kb minified, 3.4kb gzipped.
How is this even possible? A well-thought-out mechanism that just works.
Uses localStorage, indexedDB, and webSQL backends to store data offline locally in the web browser. Not just that, these 3 drivers works as one. It's triple-driver one-channal. One of a kind.
Works everywhere, on any browser and on any device: Chrome, Safari, Firefox, IE, Edge, Opera, and others including old mobile browsers, such as HTC browser and Blackberry browser.
Complex database calls wrapped in a powerful async localStorage-like consistent API. It has config(), setItem(), getItem(), each(), removeItem(), clear(), and keys().
Key-value storage type. fridge uses client-side databases as setter and getter offline data storage.
String, Number, Array, Object, Blob, File, TypedArrays (Int8Array, Int16Array, Int32Array, Uint8Array, Uint8ClampedArray, Uint16Array, Uint32Array, Float16Array, Float32Array), DataView.
If you haven't noticed yet, fridge stores a very wide range of data types, not even localForage can store these much of data types.
It does advanced databases feature-detection tests to determine their strengths and weaknesses, not just their basic support, so you don't have to worry about anything, when storing anything. fridge provides ultimate user experience.
When necessary, fridge uses fast data serializer for compatibility reasons, so all data types are supported in every storage backend, it can even store small Blobs in localStorage driver.
Smart Auto Mode
Behind-the-scenes, fridge checks to see which storage technologies are supported by the browser, and uses all the available backends.
Not just that, it checks the data type, and then chooses the one that offers the best functionality, and it provides a proper fallback as well, which makes fridge the first of its kind.
For example: if you store a string, it chooses localStorage. If you store a Blob file, it chooses indexedDB. And If one storage was full, It will fallback to another storage backend automatically.
We're not finished just yet, If both indexedDB and webSQL were supported by the browser, It chooses the faster one.
Simplified Error Handling
Simplified error handling, no complications.
Complete on its own
Some web browsers fully support indexedDB, some partially support it, and some has buggy implementations, such as Safari. With fridge, you don't have to provide any extra slow and large polyfills, such as indexedDBShim polyfill (141 KB), to fix these issues.