Installing libcaesium requires a supported version of Node and Rust. (Node 18 supported)
You can install the project with npm. In the project directory, run:
$ npm installThis fully installs the project, including installing any dependencies and running the build.
If you have already installed the project and only want to run the build, run:
$ npm run buildThis command uses the cargo-cp-artifact utility to run the Rust build and copy the built library into ./build/caesium.node.
const caesium = require('./build/caesium.node');
let parameters = {
jpeg: {
quality: 20
},
png: {
quality: 20,
force_zopfli: false
},
webp: {
quality: 20
},
gif: {
quality: 20
},
keep_metadata: true,
optimize: false,
width: 0,
height: 0
}
const result = caesium.compress('input.jpg', 'output.jpg', parameters);
// { success: true, message: '' }In the project directory, you can run:
Installs the project, including running npm run build.
Builds the Node addon (index.node) from source.
Additional cargo build arguments may be passed to npm build and npm build-* commands. For example, to enable a cargo feature:
npm run build -- --feature=beetle
Alias for npm build.
Same as npm build but, builds the module with the release profile. Release builds will compile slower, but run faster.
To learn more about Neon, see the Neon documentation.
To learn more about Rust, see the Rust documentation.
To learn more about Node, see the Node documentation.