Skip to main content

LocalStorage

Spicetify provides a wrapper for localStorage to make it easier to use.

tip

All keys created via this method is generic and stored as-is.

If you wish to store values that are specific for each user account, you can use Platform.LocalStorageAPI instead.

namespace LocalStorage {
function clear(): void;
function get(key: string): string | null;
function remove(key: string): void;
function set(key: string, value: string): void;
};

Methods

clear

Empties the list associated with the object of all key/value pairs, if there are any.

warning

This method will remove all data in local storage, not just the data that Spicetify uses. This essentially resets the client to its default state.

It will also wipe all data stored by extensions and custom apps (e.g. Marketplace, Lyrics Plus, etc.)

clear(): void

get

Get key value from local storage.

get(key: string): string | null
ParameterTypeDescription
keystringKey to get value from.

Example

const value = Spicetify.LocalStorage.get("foo");

remove

Delete key from local storage.

remove(key: string): void
ParameterTypeDescription
keystringKey to delete.

Example

Spicetify.LocalStorage.remove("foo");

set

Set new value for key in local storage.

set(key: string, value: string): void
ParameterTypeDescription
keystringKey to set value for.
valuestringValue to set.

Example

Spicetify.LocalStorage.set("foo", "bar");