Comparing version 0.0.1 to 0.0.2
@@ -8,4 +8,8 @@ // assumes it will be used as a .prototype (e.g. uses `this`) | ||
var http = require('http') | ||
var zlib = require('zlib') | ||
var request = require('request') | ||
var level = require('level') | ||
var untar = require('untar') | ||
var sleepRef = require('sleep-ref') | ||
var dirtar = require('dir-tar-stream') | ||
var storage = require(path.join(__dirname, 'storage')) | ||
@@ -49,12 +53,20 @@ | ||
if (exists) return cb(false, "A dat store already exists at " + paths.dat) | ||
newDat(cb) | ||
newDat(options, cb) | ||
}) | ||
function newDat(cb) { | ||
function newDat(options, cb) { | ||
mkdirp(paths.dat, function (err) { | ||
if (err) return cb(err) | ||
newDB(cb) | ||
if (options.remote) remoteDB(options.remote, cb) | ||
else newDB(cb) | ||
}) | ||
} | ||
function remoteDB(remote, cb) { | ||
var targz = request(remote) | ||
var gunzip = zlib.createGunzip() | ||
targz.pipe(gunzip) | ||
untar(paths.level, gunzip).node(cb) | ||
} | ||
function newDB(cb) { | ||
@@ -102,2 +114,5 @@ var db = self.db || self.level(paths.level) | ||
if (req.url === '/favicon.ico') return res.end() | ||
if (req.url === '/_archive') { | ||
return dirtar(self.paths().level).pipe(res) | ||
} | ||
sleep.httpHandler(req, res) | ||
@@ -104,0 +119,0 @@ }) |
{ | ||
"name": "dat", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "collaborative data tool", | ||
@@ -20,3 +20,5 @@ "main": "index.js", | ||
"level-mutex": "~0.6.0", | ||
"sleep-ref": "git://github.com/mikeal/SLEEP.git" | ||
"sleep-ref": "git://github.com/mikeal/SLEEP.git", | ||
"dir-tar-stream": "~0.0.3", | ||
"untar": "~0.2.3" | ||
}, | ||
@@ -23,0 +25,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
338269
467
1
9
+ Addeddir-tar-stream@~0.0.3
+ Addeduntar@~0.2.3
+ Addedbl@0.6.0(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedend-of-stream@0.1.5(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedlift-result@0.1.5(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedonce@1.3.3(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedresult@1.0.3(transitive)
+ Addedresult-core@1.2.1(transitive)
+ Addedresult-type@1.0.0(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedtar-stream@0.3.3(transitive)
+ Addeduntar@0.2.9(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedwritefile@0.2.8(transitive)