
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@e-mc/compress
Advanced tools
import type { IModule, ModuleConstructor } from "./index";
import type { BrotliCompressLevel, BufferResult, CompressFormat, CompressLevel, ReadableOptions, TryFileCompressor } from "./compress";
import type { CompressModule, CompressSettings } from "./settings";
import type { WriteStream } from "node:fs";
import type { Readable } from "node:stream";
import type { BrotliCompress, BrotliOptions, Gzip, ZlibOptions } from "node:zlib";
interface ICompress extends IModule {
module: CompressModule;
level: Record<string, number>;
compressors: Record<string, TryFileCompressor>;
chunkSize?: number;
init(...args: unknown[]): this;
register(format: string, callback: TryFileCompressor): void;
getLevel(value: string, fallback?: number): number | undefined;
getReadable(file: string | URL | Buffer, options?: ReadableOptions): Readable;
createGzip(file: string | Buffer, options?: CompressLevel): Gzip;
createBrotliCompress(file: string | Buffer, options?: BrotliCompressLevel): BrotliCompress;
createWriteStreamAsGzip(file: string | Buffer, output: string, options?: CompressLevel): WriteStream;
createWriteStreamAsBrotli(file: string | Buffer, output: string, options?: BrotliCompressLevel): WriteStream;
intoGzipStream(output: string, options?: ZlibOptions): WriteStream;
intoBrotliStream(output: string, options?: BrotliOptions): WriteStream;
writeGzip(file: string | Buffer, output: string, options?: CompressLevel): Promise<void>;
writeBrotli(file: string | Buffer, output: string, options?: CompressLevel): Promise<void>;
tryFile(file: string | Buffer, options: CompressFormat): Promise<BufferResult>;
tryFile(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
tryImage(file: string, options: CompressFormat): Promise<BufferResult>;
tryImage(file: string | Buffer, output: string, options?: CompressFormat): Promise<BufferResult>;
hasPermission(type: string, options?: unknown): boolean;
set chunkSize(value: number | string | undefined): void;
get chunkSize(): number | undefined;
get settings(): CompressSettings;
}
interface CompressConstructor extends ModuleConstructor {
singleton(): ICompress;
asBuffer(data: Buffer | Uint8Array): Buffer;
readonly prototype: ICompress;
new(module?: CompressModule): ICompress;
}
import type { CacheDirAction } from "./settings";
import type { BrotliOptions, ZlibOptions } from "node:zlib";
import type { Options as ZopfliOptions } from "node-zopfli";
interface CompressModule {
gzip?: ZlibOptions;
brotli?: BrotliOptions;
/** @deprecated */
zopfli?: ZopfliOptions;
settings?: {
broadcast_id?: string | string[];
cache?: boolean | CacheDirAction & { font?: string | number | boolean; image?: string | number | boolean; };
/** @deprecated cache.expires */
cache_expires?: number | string;
gzip_level?: number;
brotli_quality?: number;
/** @deprecated */
zopfli_iterations?: number;
chunk_size?: number | string;
};
}
const Compress = require("@e-mc/compress");
const instance = new Compress({
gzip: {
memLevel: 1,
windowBits: 16
},
tinify: {
api_key: "**********"
},
settings: {
gzip_level: 9, // Lowest priority
brotli_quality: 11,
chunk_size: "16kb" // All compression types
}
});
instance.init();
const stream = instance.createWriteStreamAsGzip("/tmp/archive.tar", "/path/output/archive.tar.gz", { level: 5, chunkSize: 4 * 1024 }); // Override settings
stream
.on("finish", () => console.log("finish"))
.on("error", err => console.error(err));
const options = {
plugin: "@pi-r/tinify",
format: "png", // Recommended
timeout: 60 * 1000, // 1m
options: {
apiKey: "**********" // Override settings
}
};
instance.tryImage("/tmp/image.png", "/path/output/compressed.png", options)
.then(data => {
console.log(Buffer.byteLength(data));
})
.catch(err => console.error(err));
BSD 3-Clause
FAQs
Compress constructor for E-mc.
The npm package @e-mc/compress receives a total of 85 weekly downloads. As such, @e-mc/compress popularity was classified as not popular.
We found that @e-mc/compress demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.