Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@ffflorian/jszip-cli

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ffflorian/jszip-cli - npm Package Compare versions

Comparing version
3.15.1
to
3.15.2
+6
-6
dist/BuildService.d.ts
import { TerminalOptions } from './interfaces.js';
export declare class BuildService {
compressedFilesCount: number;
outputFile: string | null;
outputFile: null | string;
private entries;

@@ -15,2 +15,7 @@ private readonly fileService;

save(): Promise<BuildService>;
private addFile;
private addLink;
private checkEntry;
private checkOutput;
private getBuffer;
/**

@@ -22,8 +27,3 @@ * Note: glob patterns should always use / as a path separator, even on Windows systems,

private normalizePaths;
private addFile;
private addLink;
private checkEntry;
private checkOutput;
private getBuffer;
private walkDir;
}

@@ -1,7 +0,7 @@

import path from 'node:path';
import { promises as fs } from 'node:fs';
import { glob } from 'glob';
import JSZip from 'jszip';
import logdown from 'logdown';
import { promises as fs } from 'node:fs';
import path from 'node:path';
import progress from 'progress';
import { glob } from 'glob';
import { FileService } from './FileService.js';

@@ -59,10 +59,2 @@ export class BuildService {

}
/**
* Note: glob patterns should always use / as a path separator, even on Windows systems,
* as \ is used to escape glob characters.
* https://github.com/isaacs/node-glob
*/
normalizePaths(rawEntries) {
return rawEntries.map(entry => entry.replace(/\\/g, '/'));
}
async addFile(entry, isLink = false) {

@@ -191,2 +183,10 @@ const { resolvedPath, zipPath } = entry;

}
/**
* Note: glob patterns should always use / as a path separator, even on Windows systems,
* as \ is used to escape glob characters.
* https://github.com/isaacs/node-glob
*/
normalizePaths(rawEntries) {
return rawEntries.map(entry => entry.replace(/\\/g, '/'));
}
async walkDir(entry) {

@@ -193,0 +193,0 @@ this.logger.info(`Walking directory ${entry.resolvedPath} ...`);

#!/usr/bin/env node
import { program as commander } from 'commander';
import fs from 'node:fs';
import path from 'node:path';
import { program as commander } from 'commander';
import { JSZipCLI } from './JSZipCLI.js';

@@ -54,3 +54,3 @@ const __dirname = import.meta.dirname;

await jszip.add(entries);
const { outputFile, compressedFilesCount } = await jszip.save();
const { compressedFilesCount, outputFile } = await jszip.save();
if (options.output && !options.quiet) {

@@ -80,3 +80,3 @@ console.info(`Done compressing ${compressedFilesCount} files to "${outputFile}".`);

try {
const { outputDir, extractedFilesCount } = await new JSZipCLI({
const { extractedFilesCount, outputDir } = await new JSZipCLI({
...((options.config && { configFile: options.config }) || (options.noconfig && { configFile: false })),

@@ -83,0 +83,0 @@ ...(options.force && { force: options.force }),

import { TerminalOptions } from './interfaces.js';
export declare class ExtractService {
extractedFilesCount: number;
outputDir: string | null;
outputDir: null | string;
private readonly logger;

@@ -6,0 +6,0 @@ private readonly options;

@@ -0,6 +1,6 @@

import JSZip from 'jszip';
import logdown from 'logdown';
import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import JSZip from 'jszip';
import logdown from 'logdown';
import progress from 'progress';

@@ -32,3 +32,5 @@ export class ExtractService {

}
catch (_a) { }
catch (_a) {
// no-op
}
}

@@ -59,3 +61,5 @@ const resolvedPath = path.resolve(entry);

}
catch (_b) { }
catch (_b) {
// no-op
}
}

@@ -62,0 +66,0 @@ else {

@@ -0,4 +1,4 @@

import logdown from 'logdown';
import fs from 'node:fs/promises';
import path from 'node:path';
import logdown from 'logdown';
export class FileService {

@@ -31,3 +31,5 @@ constructor(options) {

}
catch (_c) { }
catch (_c) {
// no-op
}
return true;

@@ -34,0 +36,0 @@ }

@@ -0,2 +1,2 @@

export * from './interfaces.js';
export * from './JSZipCLI.js';
export * from './interfaces.js';

@@ -0,2 +1,2 @@

export * from './interfaces.js';
export * from './JSZipCLI.js';
export * from './interfaces.js';

@@ -0,1 +1,11 @@

export interface ConfigFileOptions extends TerminalOptions {
/** Which files or directories to add. */
entries: string[];
/** Add or extract files. */
mode: 'add' | 'extract';
}
export interface Entry {
resolvedPath: string;
zipPath: string;
}
export interface TerminalOptions {

@@ -5,3 +15,3 @@ /** The compression level to use (0 = save only, 9 = best compression) (default: 5). */

/** Use a configuration file (default: .jsziprc.json). */
configFile?: string | boolean;
configFile?: boolean | string;
/** Whether to dereference (follow) symlinks (default: false). */

@@ -12,5 +22,5 @@ dereferenceLinks?: boolean;

/** Ignore entries (e.g. `*.js.map`). */
ignoreEntries?: Array<string | RegExp>;
ignoreEntries?: Array<RegExp | string>;
/** Set the output directory (default: stdout). */
outputEntry?: string | null;
outputEntry?: null | string;
/** Don't log anything excluding errors (default: false). */

@@ -21,11 +31,1 @@ quiet?: boolean;

}
export interface ConfigFileOptions extends TerminalOptions {
/** Which files or directories to add. */
entries: string[];
/** Add or extract files. */
mode: 'add' | 'extract';
}
export interface Entry {
resolvedPath: string;
zipPath: string;
}

@@ -0,4 +1,4 @@

import type { TerminalOptions } from './interfaces.js';
import { BuildService } from './BuildService.js';
import { ExtractService } from './ExtractService.js';
import type { TerminalOptions } from './interfaces.js';
export declare class JSZipCLI {

@@ -5,0 +5,0 @@ private readonly buildService;

@@ -74,3 +74,3 @@ import { cosmiconfigSync } from 'cosmiconfig';

const buildService = await this.add();
const { outputFile, compressedFilesCount } = await buildService.save();
const { compressedFilesCount, outputFile } = await buildService.save();
if (this.options.outputEntry && !this.options.quiet) {

@@ -82,3 +82,3 @@ console.info(`Done compressing ${compressedFilesCount} files to "${outputFile}".`);

else if (this.options.mode === 'extract') {
const { outputDir, extractedFilesCount } = await this.extract();
const { extractedFilesCount, outputDir } = await this.extract();
if (this.options.outputEntry && !this.options.quiet) {

@@ -85,0 +85,0 @@ console.info(`Done extracting ${extractedFilesCount} files to "${outputDir}".`);

@@ -5,3 +5,3 @@ {

"dependencies": {
"commander": "14.0.2",
"commander": "14.0.3",
"cosmiconfig": "9.0.0",

@@ -15,2 +15,3 @@ "glob": "13.0.0",

"devDependencies": {
"@types/node": "~24",
"@types/progress": "2.0.7",

@@ -21,3 +22,3 @@ "cross-env": "10.1.0",

"typescript": "5.9.3",
"vitest": "4.0.16"
"vitest": "4.0.18"
},

@@ -48,4 +49,4 @@ "engines": {

"type": "module",
"version": "3.15.1",
"gitHead": "ba772186f0c4fb05492ef586666b8e44faefe71d"
"version": "3.15.2",
"gitHead": "59997e7c64b551213644945256b13ff3ba1ccfcd"
}