Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unstorage

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unstorage

[![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] [![Github Actions][github-actions-src]][github-actions-href] [![Codecov][codecov-src]][codecov-href] [![bundle][bundle-src]][bundle-href]

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1M
decreased by-4.12%
Maintainers
1
Weekly downloads
 
Created

What is unstorage?

The 'unstorage' npm package is a versatile storage utility that provides a unified API for interacting with various storage backends. It allows developers to easily switch between different storage mechanisms such as local storage, session storage, and even remote storage solutions without changing the core logic of their applications.

What are unstorage's main functionalities?

Local Storage

This feature allows you to interact with local storage using a simple API. You can set, get, and remove items from local storage.

const { createStorage } = require('unstorage');
const localStorage = createStorage();

// Set a value
await localStorage.setItem('key', 'value');

// Get a value
const value = await localStorage.getItem('key');
console.log(value); // Outputs: 'value'

// Remove a value
await localStorage.removeItem('key');

Session Storage

This feature allows you to interact with session storage using the same API as local storage. You can set, get, and remove items from session storage.

const { createStorage } = require('unstorage');
const sessionStorage = createStorage({ driver: 'session' });

// Set a value
await sessionStorage.setItem('key', 'value');

// Get a value
const value = await sessionStorage.getItem('key');
console.log(value); // Outputs: 'value'

// Remove a value
await sessionStorage.removeItem('key');

Remote Storage

This feature allows you to interact with remote storage solutions via HTTP. You can set, get, and remove items from a remote storage backend.

const { createStorage } = require('unstorage');
const remoteStorage = createStorage({ driver: 'http', baseURL: 'https://api.example.com/storage' });

// Set a value
await remoteStorage.setItem('key', 'value');

// Get a value
const value = await remoteStorage.getItem('key');
console.log(value); // Outputs: 'value'

// Remove a value
await remoteStorage.removeItem('key');

Other packages similar to unstorage

FAQs

Package last updated on 07 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc