Skip to content

It's like localStorage or sessionStorage but with cookies.

Notifications You must be signed in to change notification settings

ncisrc/cookies-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Cookies Storage

Have you ever dreamed to use Cookies like you use LocalStorage ? hum? And If I say that this lib is very light ? hum ?

Happy Cookie Storage !

Install

npm i @ncisrc/cookies-storage

Use

import { cookiesStorage } from "cookies-storage"

cookieStorage.setItem(key, value);
const value = cookieStorage.getItem(key);

You can change some cookies options with the third parameter

cookieStorage.setItem(key, value, {maxAge: 60});

Options

Default 'options' values

options = {
  maxAge   : 604800, // 7 days
  sameSite : 'Strict',
  path     : '/',
  secure   : true,
  httpOnly : false,
}

You'll find more about theses options in this page :

About

It's like localStorage or sessionStorage but with cookies.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages