Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dat

Package Overview
Dependencies
Maintainers
1
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dat - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

21

lib/commands.js

@@ -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 @@ })

6

package.json
{
"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": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc