
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
local-sync
Advanced tools
A friendly, tiny, synchronous, namespaced, and dependency free local storage solution.
A friendly, tiny, and cross-browser local storage solution:
✓ No dependencies
✓ Synchronous
✓ Namespaced storage support
✓ In-memory fallback
yarn add local-sync
Common JS
https://unpkg.com/local-sync@x.x.x/dist/cjs/local-sync.js
https://unpkg.com/local-sync@x.x.x/dist/cjs/local-sync.min.js
ES Module
https://unpkg.com/local-sync@x.x.x/dist/esm/local-sync.js
https://unpkg.com/local-sync@x.x.x/dist/esm/local-sync.min.js
UMD
https://unpkg.com/local-sync@x.x.x/dist/umd/local-sync.js
https://unpkg.com/local-sync@x.x.x/dist/umd/local-sync.min.js
See API Documentation.
Set or get the current bucket. Subsequent methods operate only in the current bucket namespace.
ls = new LocalSync() // default settings
ls = new LocalSync({ // custom settings
prefix: 'ocean',
bucket: 'fish',
separator: '~'
})
ls.setBucket('BikiniBottom') // => 'BikiniBottom'
ls.getBucket() // => 'BikiniBottom'
List all buckets in storage.
ls.allBuckets() // => [...buckets]
Use any JSON serializable data type.
ls.set('bob', {name: 'SpongeBob'})
ls.get('bob')
// => {name: 'SpongeBob'}
ls.set('quotes', ['Squidward!'])
ls.get('quotes')
// => ['Squidward!]
Update stored objects and arrays.
ls.put('bob', {address: '124 Conch Street'})
// => {name: 'SpongeBob', address: '124 Conch Street'}
ls.put('quotes', ['Why so crabby, Patty?'])
// => ['Squidward!', 'Why so crabby, Patty?']
List all keys in storage.
ls.keys()
// => ['bob', 'quotes']
List all values in storage.
ls.values()
// [
// {address: '124 Conch Street', name: 'SpongeBob'},
// ['Squidward!', 'Why so crabby, Patty?']
// ]
List all keys and values in storage.
ls.getAll()
// [
// {address: '124 Conch Street', name: 'SpongeBob'},
// {quotes: ['Squidward!', 'Why so crabby, Patty?']}
// ]
Remove a single value by key or clear all values.
ls.remove('bob')
ls.keys()
// => ['quotes']
Clear all keys and values.
ls.clear()
ls.keys()
// => []
FAQs
A friendly, tiny, synchronous, namespaced, and dependency free local storage solution.
The npm package local-sync receives a total of 0 weekly downloads. As such, local-sync popularity was classified as not popular.
We found that local-sync demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.