Skip to content

Installation

StorageManager.js can be installed via npm or included directly in your HTML. Choose the method that best fits your project setup.

Terminal window
npm install web-storage-manager-js

Then import it in your JavaScript or TypeScript file:

import StorageManager from 'web-storage-manager-js';
// Create a new instance
const storage = new StorageManager();

You can include StorageManager.js directly from a CDN:

<!-- Replace x.y.z with the desired version -->
<script src="https://cdn.jsdelivr.net/npm/web-storage-manager-js@x.y.z/StorageManager.js"></script>
<script>
// StorageManager is now available globally
const storage = new StorageManager();
</script>

To always use the latest version (not recommended for production):

<script src="https://cdn.jsdelivr.net/npm/web-storage-manager-js/StorageManager.js"></script>

You can also download the StorageManager.js file and include it locally:

<script src="path/to/StorageManager.js"></script>

Download the latest version from the GitHub repository.

If you enable compression (which is enabled by default), StorageManager.js will automatically load LZString from CDN when needed. You don’t need to include it manually.

However, if you want to include it yourself or use it offline:

<script src="https://cdnjs.cloudflare.com/ajax/libs/lz-string/1.5.0/lz-string.min.js"></script>
<script src="path/to/StorageManager.js"></script>

To verify the installation, try creating a simple instance:

const storage = new StorageManager();
console.log('StorageManager loaded successfully!');

Now that you have StorageManager.js installed, head over to the Quick Start guide to learn how to use it.