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

workshopper-adventure-storage

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workshopper-adventure-storage

Storage system for workshopper-adventure to store the preferences.

  • 3.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

workshopper-adventure-storage

NPM version Downloads Build Status Coverage Status NPM deps NPM dev devp

Simple storage for workshopper-adventure

Originally included as part of workshopper-adventure, mostly written by Martin Heidegger

Based on prior work of: @substack @rvagg

Install

npm install workshopper-adventure-storage --save
const createStorage = require('workshopper-adventure-storage')

Usage

createStorage.userDir

A default path to store data in.

createStorage([dir[, ...]])

Accepts a sequence of paths for path.resolve to use as the storage directory.

const createStorage = require('workshopper-adventure-storage')
const storage = createStorage(createStorage.userDir, 'my-workshopper')

Properties

storage.dir

The path to store data in.

Methods

storage.save('name', data)

JSON encodes and writes a file to the storage directory. The following will save the file as index.json.

const data = {
  foo: 'bar'
}
storage.save('index', data)

storage.get('name')

Retrieves and unserializes a file from storage.

var data = storage.get('index')

storage.reset()

Clears the storage directory.

storage.reset()

storage.promises

This module seamlessly supports async operations using the .promises object.

const storage =
  createStorage(createStorage.userDir, 'promise-workshop')
    .promises;

storage.dir // works synchronously
await storage.save('name', {})
await storage.get('name')
await storage.reset()

Keywords

FAQs

Package last updated on 03 Jul 2020

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