Proxy random access storage requests dynamically.
$ npm install random-access-storage-proxyconst storage = proxy([target])Creates a proxy random access storage object that dynamically
proxies open(), close(), destroy(), read(), write(), stat(),
and del() requests to target, if given. If target is not given, a
target can be set with storage.setTarget(target).
Storage state properties like writable, readable, statable, and
deletable are configured to match the target state properties. Proxy
implementation methods like _write(), _read(), _stat(), and _del
are set to the original default implementation for a
random-access-storage object when target lacks one.
Example:
// initialize proxy with 'random-access-storage'
const store = proxy(ram())
// initialize proxy to target read only storage
store.setTarget(raf('path/to/file', { writable: false }))Sets proxy target, reconfigures and restore storage state properties and methods.
store.setTarget(ram())
store.setTarget(raf(filename))
store.setTarget(rah(url))Resets the proxy storage state to the default random-access-storage implementation state.
storage.reset()MIT