Browse Source

Merge branch 'example' of CoBox/kappa-drive-mount into master

kyphae 3 years ago
parent
commit
18541d34e1
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
+drive.ready(() => {
11
+  mounter.mount(drive, mountdir).then((destroy) => {
12
+    // Drive is ready and mounted...
13
+    setTimeout(() => {
14
+      // Waiting 30 seconds for demonstration purposes
15
+      // then terminate the mount
16
+      mounter.cleanup(destroy, mountdir)
17
+    }, 30000)
18
+  })
19
+})