New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

zip-a-folder

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zip-a-folder - npm Package Compare versions

Comparing version 3.1.5 to 3.1.6

21

dist/lib/cjs/ZipAFolder.js

@@ -5,5 +5,6 @@ 'use strict';

const tslib_1 = require("tslib");
const fs_1 = require("fs");
const path_1 = tslib_1.__importDefault(require("path"));
const archiver_1 = tslib_1.__importDefault(require("archiver"));
const fs_1 = tslib_1.__importDefault(require("fs"));
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
const is_glob_1 = tslib_1.__importDefault(require("is-glob"));

@@ -84,5 +85,5 @@ const glob_1 = require("glob");

if (!(0, is_glob_1.default)(src)) {
yield fs_1.default.promises.access(src, fs_1.default.constants.R_OK);
yield promises_1.default.access(src, promises_1.default.constants.R_OK);
}
yield fs_1.default.promises.access(targetBasePath, fs_1.default.constants.R_OK | fs_1.default.constants.W_OK);
yield promises_1.default.access(targetBasePath, promises_1.default.constants.R_OK | promises_1.default.constants.W_OK);
}

@@ -100,6 +101,6 @@ catch (e) {

}
output = fs_1.default.createWriteStream(targetFilePath);
output = (0, fs_1.createWriteStream)(targetFilePath);
}
else if (zipAFolderOptions && zipAFolderOptions.customWriteStream) {
output = zipAFolderOptions === null || zipAFolderOptions === void 0 ? void 0 : zipAFolderOptions.customWriteStream;
output = zipAFolderOptions.customWriteStream;
}

@@ -116,6 +117,8 @@ else {

for (const file of globList) {
const content = yield fs_1.default.promises.readFile(file);
zipArchive.append(content, {
name: file,
});
if ((yield promises_1.default.lstat(file)).isFile()) {
const content = yield promises_1.default.readFile(file);
zipArchive.append(content, {
name: file,
});
}
}

@@ -122,0 +125,0 @@ }

'use strict';
import { createWriteStream } from 'fs';
import path from 'path';
import archiver from 'archiver';
import fs from 'fs';
import fs from 'fs/promises';
import isGlob from 'is-glob';

@@ -75,5 +76,5 @@ import { glob } from 'glob';

if (!isGlob(src)) {
await fs.promises.access(src, fs.constants.R_OK);
await fs.access(src, fs.constants.R_OK);
}
await fs.promises.access(targetBasePath, fs.constants.R_OK | fs.constants.W_OK);
await fs.access(targetBasePath, fs.constants.R_OK | fs.constants.W_OK);
}

@@ -91,6 +92,6 @@ catch (e) {

}
output = fs.createWriteStream(targetFilePath);
output = createWriteStream(targetFilePath);
}
else if (zipAFolderOptions && zipAFolderOptions.customWriteStream) {
output = zipAFolderOptions?.customWriteStream;
output = zipAFolderOptions.customWriteStream;
}

@@ -107,6 +108,8 @@ else {

for (const file of globList) {
const content = await fs.promises.readFile(file);
zipArchive.append(content, {
name: file,
});
if ((await fs.lstat(file)).isFile()) {
const content = await fs.readFile(file);
zipArchive.append(content, {
name: file,
});
}
}

@@ -113,0 +116,0 @@ }

'use strict';
import {WriteStream} from 'fs';
import {WriteStream, createWriteStream} from 'fs';
import path from 'path';
import archiver from 'archiver';
import fs from 'fs';
import fs from 'fs/promises';
import isGlob from 'is-glob';

@@ -123,7 +123,8 @@ import {glob} from 'glob';

}
try {
if (!isGlob(src)) {
await fs.promises.access(src, fs.constants.R_OK); //eslint-disable-line no-bitwise
await fs.access(src, fs.constants.R_OK); //eslint-disable-line no-bitwise
}
await fs.promises.access(targetBasePath, fs.constants.R_OK | fs.constants.W_OK); //eslint-disable-line no-bitwise
await fs.access(targetBasePath, fs.constants.R_OK | fs.constants.W_OK); //eslint-disable-line no-bitwise
} catch (e: any) {

@@ -143,5 +144,5 @@ throw new Error(`Permission error: ${e.message}`);

output = fs.createWriteStream(targetFilePath);
output = createWriteStream(targetFilePath);
} else if (zipAFolderOptions && zipAFolderOptions.customWriteStream) {
output = zipAFolderOptions?.customWriteStream;
output = zipAFolderOptions.customWriteStream;
} else {

@@ -161,6 +162,8 @@ throw new Error('You must either provide a target file path or a custom write stream to write to.');

for (const file of globList) {
const content = await fs.promises.readFile(file);
zipArchive.append(content, {
name: file,
});
if ((await fs.lstat(file)).isFile()) {
const content = await fs.readFile(file);
zipArchive.append(content, {
name: file,
});
}
}

@@ -167,0 +170,0 @@ } else {

{
"name": "zip-a-folder",
"version": "3.1.5",
"version": "3.1.6",
"description": "Zip/Tar a complete folder or a glob list into a zip/tgz file",

@@ -53,20 +53,20 @@ "author": "Marius Augenstein",

"@types/is-glob": "^4.0.4",
"@types/jest": "^29.5.10",
"@types/node": "^20.10.3",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.8",
"@types/rimraf": "^3.0.2",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"chokidar": "^3.5.3",
"coveralls": "^3.1.1",
"eslint": "^8.55.0",
"eslint": "^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.6.2",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"jest-extended": "^4.0.2",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"rimraf": "^5.0.5",

@@ -73,0 +73,0 @@ "ts-jest": "^29.1.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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