You can read details such as the key or writability of a drive after 'ready' has been emitted: drive. You can also force creation of a new drive by passing null for the key: const drive = new Hyperdrive ( './storage-path', null ) // create new This will only load the drive, so if no data exists locally yet then it will instantiate as an empty read-only drive waiting to pull data from the network: const drive = new Hyperdrive ( './storage-path', Buffer. You can load a specific drive within your storage by supplying a key. If a drive exists at the path you provide, it will be loaded. To create or load a hyperdrive as a standalone module, you follow this simple pattern: const Hyperdrive = require ( 'hyperdrive' )Ĭonst drive = new Hyperdrive ( './storage-path' ) // get or create drive at given path Npm install Step 1a: Using standalone modules If you want to follow along with the code, setup the walkthrough repo: git clone We'll then demonstrate the basic APIs (step 2) and then learn about versioning (step 3). In this walkthrough, we'll create hyperdrives using standalone modules and Hyperspace (step 1). That said, the writer can replicate to many readers, in a manner similar to BitTorrent.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |