workshopper-adventure-storage
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 =
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 = const storage =
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
storage.get('name')
Retrieves and unserializes a file from storage.
var data = storage
storage.reset()
Clears the storage directory.
storage