Logo

dev-resources.site

for different kinds of informations.

Discover Kando The Lightweight Storage Utility You Didn’t Know You Needed

Published at
1/5/2025
Categories
javascript
node
web
frontend
Author
nassiry
Categories
4 categories in total
javascript
open
node
open
web
open
frontend
open
Author
7 person written this
nassiry
open
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!

Why Use Kando?

Kando offers powerful features in a lightweight package:

  • Cross-Environment Support: Works in both browsers and Node.js, with a fallback to an in-memory Map if localStorage or sessionStorage is unavailable.
  • Namespace Management: Organize and group related data for easier retrieval and cleanup.
  • Nested Path Access: Use dot notation to access or update deeply nested properties.
  • Data Expiration: Automatically expire session data after a defined duration.
  • Flexible Data Handling: Easily work with single values, arrays, and objects.

Installation

Node.js

Install Kando with npm:

npm install kando-storage
Enter fullscreen mode Exit fullscreen mode

Browser

Add Kando to your project using a script tag:

<script src="path/to/kando.js"></script>
Enter fullscreen mode Exit fullscreen mode

Quick Examples

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 }
Enter fullscreen mode Exit fullscreen mode

Clearing Data

// Remove a specific property
kando('local.user.profile.name', null);

// Clear an entire namespace
kando('local.user', null);
Enter fullscreen mode Exit fullscreen mode

Session Storage with Expiration

// 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
Enter fullscreen mode Exit fullscreen mode

Dive Deeper into Kando

These examples only scratch the surface of what Kando can do. Check out the full README on GitHub for:

  • Advanced examples like handling nested paths, arrays, and namespaces.
  • Full API reference with parameter descriptions.
  • Guidance on using Kando’s fallback mechanism in Node.js environments.

Conclusion

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! 🚀

web Article's
30 articles in total
Favicon
The Surprising Truth About Local SEO for Attorneys in 2025: Why They Are Rethinking Their Strategy
Favicon
SEO AI: Your Secret Weapon for Boosting SEO Performance!
Favicon
What is Web Hosting and How Does It Work?
Favicon
FastHTML and Heroku
Favicon
Stack Developer Web
Favicon
Adding structured data with Perl
Favicon
Learn a little about the patriarchal protocol of the internet, the father of tcp/ip!!
Favicon
Static website forms
Favicon
Creating a system that connects tailors with customers for suit rentals involves integrating features to enhance user experience for both parties. (web, mobile , payment)
Favicon
How DevOps Accelerates the Software Development Lifecycle
Favicon
My Portfolio is finally done !🙌
Favicon
Discover Kando The Lightweight Storage Utility You Didn’t Know You Needed
Favicon
How to create a hugo theme with contact form
Favicon
How to Implement Image Drag-and-Drop in React
Favicon
"Different Types of CSS Selectors”
Favicon
What is the Difference Between Data Science and Web Development?
Favicon
Are Web APIs the same as REST APIs? How to Improve your Web Apps with Web APIs
Favicon
Cozy Blocks: The Ultimate Gutenberg Blocks Plugin & Page Builder for WordPress
Favicon
Introducing the New Flutter AI AssistView Widget
Favicon
Styling with FSCSS
Favicon
Loco 0.14 on Cathyos: 始め方
Favicon
"Powerful Tricks and Features About HTML You Should Know"
Favicon
Um reels meu atingiu 1 milhão de visualizações com humor para desenvolvedores
Favicon
Understanding Sitemaps: The Simple Guide 💯
Favicon
Web Development: A Guide to Building Accessible and Engaging Platforms
Favicon
Bem-vindo ao desenvolvimento Web: Um guia prático para quem está começando do zero
Favicon
Template Poster IG
Favicon
Web Component
Favicon
Boost Your Business Online: Why Having a Website Is a Must in 2024
Favicon
Barış Dayak - Dijital Çözümler artık Apple Haritalar'da!

Featured ones: