pear-prerelease 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +19 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -80,7 +80,26 @@ console.log(drive.core)
80
80
  console.log()
81
81
  console.log('Swarming until you exit...')
82
82
 
83
+ let timeout = setTimeout(teardown, 15_000)
84
+ const blobs = await drive.getBlobs()
85
+
86
+ drive.core.on('upload', function () {
87
+ clearTimeout(timeout)
88
+ timeout = setTimeout(teardown, 15_000)
89
+ })
90
+
91
+ blobs.core.on('upload', function () {
92
+ clearTimeout(timeout)
93
+ timeout = setTimeout(teardown, 15_000)
94
+ })
95
+
83
96
  function print (data) {
84
97
  n++
85
98
  console.log(data.op === 'add' ? '+' : data.op === 'remove' ? '-' : '~', data.key, [data.bytesAdded, -data.bytesRemoved])
86
99
  }
100
+
101
+ async function teardown () {
102
+ console.log('Shutting down due to inactivity...')
103
+ await swarm.destroy()
104
+ await drive.close()
105
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-prerelease",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Proper prerelease flows with pear",
5
5
  "main": "index.js",
6
6
  "bin": {