@node-minify/run
v10.4.0
Published
exec commands for @node-minify
Readme
@node-minify/run
Command execution wrapper for Java-based compressors in node-minify.
This package provides utilities to spawn Java processes for compressors like YUI Compressor and Google Closure Compiler.
Installation
npm install @node-minify/runUsage
import { runCommandLine } from '@node-minify/run';
const result = await runCommandLine({
args: ['-jar', 'path/to/compiler.jar'],
data: 'var foo = 1;'
});
console.log(result); // Minified outputAPI
runCommandLine(params)
Executes a Java command with the provided arguments and pipes data to stdin.
Parameters
| Name | Type | Description |
|------|------|-------------|
| params.args | string[] | Command line arguments for the Java process |
| params.data | string | Content to minify (piped to stdin) |
Returns
Promise<string> - The minified content from stdout.
Throws
Errorif the Java process exits with a non-zero codeErrorif there's a process spawn error
Requirements
- Java Runtime Environment (JRE) must be installed and available in PATH
