p2pic-config
v1.0.1
Published
Tools for safely managing a p2pic config
Readme
P2Pic Config
Tools for safely managing a P2Pic config.
Install
npm i p2pic-configAPI
Note: all operations will create a new empty config if none is found.
Note: all operations will throw if another operation is already running.
const config = new P2PicConfig(location)
Create a new P2Pic instance to manage the config at the given location.
await config.getLocalFolders()
Returns all local folders as an object: { <path>: {} }
await config.getRemoteFolders()
Returns all remote folders as an object: { <z32-key>: { targetPath } }
await config.addLocalFolder (localFolderDir)
Adds a new local folder to the config.
Throws if the folder does not exist, or if it was already added.
await config.addRemoteFolder(sourceKey, targetPath)
Adds the Hyperdrive at sourceKey to the config, mirroring it to targetPath.
Throws if an entry for sourceKey already exists, or if targetPath does not include 'p2pic' somewhere in its path (to avoid accidentally deleting important data when the target dir is synchronised to the remote).
