With this package you can locally and programmatically modify the LocalStorage and SessionStorage of a browser. This also applies to an Browser based Electron app.
dbPath
option for other databases.
Install package:
# npm
npm install inspect-browser-storage
# yarn
yarn install inspect-browser-storage
# pnpm
pnpm install inspect-browser-storage
Import:
// ESM
import { writeToStorage, readFromStorage } from 'inspect-browser-storage'
// CommonJS
const { writeToStorage, readFromStorage } = require('inspect-browser-storage')
Example:
const data = await readFromStorage('test-application.de', 'auth_token')
// -> Returns the value of the key 'auth_token' in the localStorage of 'https://test-application.de/'
Options:
-
dbPath
: (string) The domain in the storage. -
key
: (string) the key of the item in storage -
options?
: (object) Options are defaults and get merged with the default options.-
dbPath
: (string) Path to the database, default is the chromium path on your system -
autoUnlink
: (boolean) If true, the package will try to unlock the database LOCK File. Default is true -
protocol
: (string) Which protocol should be added to the domain, can be https:// or http://. Default is https:// -
storage
: (string) Define which storage it should use, can belocalStorage
orsessionStorage
. Default islocalStorage
-
Example:
const data = await writeToStorage('test-application.de', 'auth_token', 'eyDasdlok.......')
Options:
-
dbPath
: (string) The domain in the storage. -
key
: (string) the key of the item in storage -
value
: (string) the value which should set to the key in storage -
options?
: (object) Options are defaults and get merged with the default options.-
dbPath
: (string) Path to the database, default is the chromium path on your system -
autoUnlink
: (boolean) If true, the package will try to unlock the database LOCK File. Default is true -
protocol
: (string) Which protocol should be added to the domain, can be https:// or http://. Default is https:// -
storage
: (string) Define which storage it should use, can belocalStorage
orsessionStorage
. Default islocalStorage
-
- Clone this repository
- Install dependencies using
yarn install
- Run watcher build
yarn dev
Made with 💚 by Conner Bachmann.
The idea originally comes from Jan Bölsche and his package chrome-localstorage
Published under MIT License.