New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

apt-cli

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apt-cli - npm Package Compare versions

Comparing version
0.1.14
to
0.1.15
+3
-4
dist/streams.d.ts

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

import xz from "lzma-native";
import { Duplex, PassThrough, Readable, Stream } from "stream";

@@ -6,8 +5,8 @@ import { ReadableStream } from "stream/web";

export declare const createGzipStream: () => import("zlib").Unzip;
export declare const createBzip2Stream: () => import("through").ThroughStream;
export declare const createXZStream: () => xz.JSLzmaStream;
export declare const createBzip2Stream: () => Duplex;
export declare const createXZStream: () => Duplex;
export declare const createHashStream: (file: string, type: string, hash: string) => PassThrough;
export declare const createProgressStream: (file: string, size: number) => PassThrough;
export declare const streamToBuffer: (stream: Stream) => Promise<Buffer>;
export declare const createCacheStream: (to: string) => PassThrough;
export declare const createCacheStream: (to: string, total: number) => PassThrough;
export declare const toReadableStream: (rs: ReadableStream) => Readable;

@@ -9,3 +9,3 @@ import { createUnzip } from "zlib";

import { formatUnit, multiBar, truncateFilename } from "./progress.js";
import { unlink } from "fs/promises";
import { rename, unlink } from "fs/promises";
const pipelineDuplex = (stream, dest) => {

@@ -73,14 +73,20 @@ stream.pipe(dest);

};
const createCacheStream = (to) => {
const stream = createWriteStream(to, { encoding: "binary" });
const createCacheStream = (to, total) => {
const tmp = to + ".tmp";
const stream = createWriteStream(tmp, { encoding: "binary" });
const check = async (error) => {
try {
if (error || stream.bytesWritten != total) {
await unlink(to);
} else {
await rename(tmp, to);
}
} catch (error2) {
console.error("createCacheStream:" + error2, { cause: error2 });
}
};
stream.once("end", check);
stream.once("error", check);
const passThrough = new PassThrough();
passThrough.pipe(stream);
passThrough.once("error", async () => {
try {
stream.destroy();
await unlink(to);
} catch (error) {
console.error(error);
}
});
return passThrough;

@@ -87,0 +93,0 @@ };

@@ -53,6 +53,9 @@ import { access, mkdir } from "fs/promises";

if (resp.status >= 400 || resp.body == null) {
throw new Error(`fetch ${url}: ${resp.status} ${resp.statusText}`);
throw new Error(
`fetch error:${url}: ${resp.status} ${resp.statusText}`
);
}
break;
} catch (error) {
console.error(`fetch ${url}:`, error);
console.error(`fetch error:${url}:`, error);
}

@@ -67,3 +70,3 @@ }

if (cache) {
stream = pipelineDuplex(stream, createCacheStream(cache));
stream = pipelineDuplex(stream, createCacheStream(cache, total));
}

@@ -70,0 +73,0 @@ if (!option?.quiet) {

{
"name": "apt-cli",
"type": "module",
"version": "0.1.14",
"version": "0.1.15",
"description": "APT CLI - Used to parse the DEB package dependency tree.",

@@ -6,0 +6,0 @@ "main": "./dist/index.js",