Home >Web Front-end >JS Tutorial >Discover Kando The Lightweight Storage Utility You Didn't Know You Needed
Managing data storage in web and Node.js applications can sometimes feel cumbersome, especially when dealing with localStorage or sessionStorage. Meet Kando—a versatile 2KB gzip storage utility that streamlines your storage tasks with its intuitive API.
Whether you're working on a small web app or a complex Node.js project, Kando's flexibility and developer-friendly design can make your life easier. Let's dive into why it's worth a try!
Kando offers powerful features in a lightweight package:
Install Kando with npm:
npm install kando-storage
Add Kando to your project using a script tag:
<script src="path/to/kando.js"></script>
Here are a few examples to get you started. More advanced usage is available in the GitHub repository.
Setting and Retrieving Data
const kando = require('kando-storage'); // Store a single value kando('local.app.theme', 'dark'); // Retrieve the value console.log(kando('local.app.theme')); // Output: 'dark' // Store an object kando('local.user.profile', { name: 'Alice', age: 30 }); // Retrieve the object console.log(kando('local.user.profile')); // Output: { name: 'Alice', age: 30 }
// Remove a specific property kando('local.user.profile.name', null); // Clear an entire namespace kando('local.user', null);
// Store session data with a 60-second expiration kando('session.tempData', 'Temporary', 60); // Access it before it expires console.log(kando('session.tempData')); // Output: 'Temporary' // After 60 seconds, it will automatically expire
These examples only scratch the surface of what Kando can do. Check out the full README on GitHub for:
Kando is a simple yet powerful tool to manage storage seamlessly across browsers and Node.js. Its small size, feature-rich API, and ease of use make it a must-try for developers.
Ready to simplify your storage? Get started on GitHub today! ?
The above is the detailed content of Discover Kando The Lightweight Storage Utility You Didn't Know You Needed. For more information, please follow other related articles on the PHP Chinese website!