Browse Source

add an example script

Kieran Gibb 3 years ago
parent
commit
f98f570b9a
No account linked to committer's email address
1 changed files with 19 additions and 0 deletions
  1. 19
    0
      example.js

+ 19
- 0
example.js View File

@@ -0,0 +1,19 @@
1
+const KappaDrive = require('kappa-drive')
2
+const Mount = require('./')
3
+
4
+const mountdir = './mnt'
5
+const storage = './drive'
6
+const drive = KappaDrive(storage)
7
+
8
+const mounter = Mount()
9
+
10
+var mounted = mounter.mount(drive, mountdir)
11
+
12
+drive.ready(() => {
13
+  mounted.then((destroy) => {
14
+    // Drive is ready and mounted...
15
+
16
+    // To terminate the mount
17
+    mounter.cleanup(destroy, mountdir)
18
+  })
19
+})