Socket
Socket
Sign inDemoInstall

extract-zip

Package Overview
Dependencies
21
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

23

index.js

@@ -9,6 +9,2 @@ var fs = require('fs')

// lolol zips
var MAGIC_SYMLINK_ATTR_1 = 2716663808
var MAGIC_SYMLINK_ATTR_2 = 2716680192
module.exports = function(zipPath, opts, cb) {

@@ -32,2 +28,3 @@ debug('opening', zipPath, 'with opts', opts)

debug('zipfile entry', entry.fileName)
if (/\/$/.test(entry.fileName)) {

@@ -38,2 +35,7 @@ // directory file names end with '/'

if (/^__MACOSX\//.test(entry.fileName)) {
// dir name starts with __MACOSX/
return
}
q.push(entry, function(err) {

@@ -58,10 +60,9 @@ debug('finished processing', entry.fileName, {err: err})

var destDir = path.dirname(dest)
var symlink = false
if (entry.externalFileAttributes === MAGIC_SYMLINK_ATTR_1 ||
entry.externalFileAttributes === MAGIC_SYMLINK_ATTR_2) {
symlink = true
}
// convert external file attr int into a fs stat mode int
var mode = (entry.externalFileAttributes >> 16) & 0xFFFF
// check if it's a symlink (using stat mode constants)
var IFMT = 61440
var IFLNK = 40960
var symlink = (mode & IFMT) === IFLNK

@@ -68,0 +69,0 @@ zipfile.openReadStream(entry, function(err, readStream) {

{
"name": "extract-zip",
"version": "1.0.1",
"version": "1.0.2",
"description": "unzip a zip file into a directory using 100% pure gluten-free organic javascript",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -40,8 +40,2 @@ # extract-zip

If not specified, `targetDirectory` will default to `process.cwd()`.
## stuff to figure out
-- better handling of magic symlink attr
-- ignore __macosx folder?
-- when to chmod +x (internal file attribute?)
If not specified, `targetDirectory` will default to `process.cwd()`.
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