Socket
Socket
Sign inDemoInstall

tar-fs

Package Overview
Dependencies
22
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

42

index.js

@@ -20,3 +20,3 @@ var tar = require('tar-stream')

var statAll = function(cwd, ignore) {
var statAll = function(fs, cwd, ignore) {
var queue = ['.']

@@ -59,6 +59,7 @@

var xfs = opts.fs || fs
var ignore = opts.ignore || noop
var map = opts.map || noop
var mapStream = opts.mapStream || echo
var statNext = statAll(cwd, ignore)
var statNext = statAll(xfs, cwd, ignore)
var pack = tar.pack()

@@ -69,3 +70,3 @@

var onlink = function(filename, header) {
fs.readlink(path.join(cwd, filename), function(err, linkname) {
xfs.readlink(path.join(cwd, filename), function(err, linkname) {
if (err) return pack.destroy(err)

@@ -113,3 +114,3 @@ header.linkname = normalize(linkname)

if (!entry) return
var rs = fs.createReadStream(path.join(cwd, filename))
var rs = xfs.createReadStream(path.join(cwd, filename))

@@ -133,2 +134,10 @@ pump(mapStream(rs), entry)

var processGetuid = function() {
return process.getuid ? process.getuid() : -1
}
var processUmask = function() {
return process.umask ? process.umask() : 0
}
exports.extract = function(cwd, opts) {

@@ -138,10 +147,11 @@ if (!cwd) cwd = '.'

var xfs = opts.fs || fs
var ignore = opts.ignore || noop
var map = opts.map || noop
var mapStream = opts.mapStream || echo
var own = opts.chown !== false && !win32 && process.getuid() === 0
var own = opts.chown !== false && !win32 && processGetuid() === 0
var extract = tar.extract()
var stack = []
var now = new Date()
var umask = typeof opts.umask === 'number' ? ~opts.umask : ~process.umask()
var umask = typeof opts.umask === 'number' ? ~opts.umask : ~processUmask()
var dmode = typeof opts.dmode === 'number' ? opts.dmode : 0

@@ -165,3 +175,3 @@ var fmode = typeof opts.fmode === 'number' ? opts.fmode : 0

if (!top) return cb()
fs.utimes(top[0], now, top[1], cb)
xfs.utimes(top[0], now, top[1], cb)
}

@@ -172,6 +182,6 @@

if (header.type === 'directory') return fs.utimes(name, now, header.mtime, cb)
if (header.type === 'directory') return xfs.utimes(name, now, header.mtime, cb)
if (header.type === 'symlink') return utimesParent(name, cb) // TODO: how to set mtime on link?
fs.utimes(name, now, header.mtime, function(err) {
xfs.utimes(name, now, header.mtime, function(err) {
if (err) return cb(err)

@@ -184,4 +194,4 @@ utimesParent(name, cb)

var link = header.type === 'symlink'
var chmod = link ? fs.lchmod : fs.chmod
var chown = link ? fs.lchown : fs.chown
var chmod = link ? xfs.lchmod : xfs.chmod
var chown = link ? xfs.lchown : xfs.chown

@@ -217,4 +227,4 @@ if (!chmod) return cb()

if (win32) return next() // skip symlinks on win for now before it can be tested
fs.unlink(name, function() {
fs.symlink(header.linkname, name, stat)
xfs.unlink(name, function() {
xfs.symlink(header.linkname, name, stat)
})

@@ -224,3 +234,3 @@ }

var onfile = function() {
var ws = fs.createWriteStream(name)
var ws = xfs.createWriteStream(name)

@@ -235,6 +245,6 @@ pump(mapStream(stream), ws, function(err) {

stack.push([name, header.mtime])
return mkdirp(name, stat)
return mkdirp(name, {fs:xfs}, stat)
}
mkdirp(path.dirname(name), function(err) {
mkdirp(path.dirname(name), {fs:xfs}, function(err) {
if (err) return next(err)

@@ -241,0 +251,0 @@ if (header.type === 'symlink') return onlink()

{
"name": "tar-fs",
"version": "1.0.0",
"version": "1.1.0",
"description": "filesystem bindings for tar-stream",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc