cvm-rs: version 0.2.0

- switch to napi-rs. this mostly affects only the backend side of things, but IMO napi-rs is better (also, way less boilerplate is needed compared to neon).

- jpeg encoding no longer clones the input buffer internally (or wraps it in a Mutex as well), thanks to napi-rs not sucking in this regard. this is *probably* a micro-optimization, but will make it easier to later on do parallel encoding of all rectangles

- guac encoding is weird. This is kind of a painpoint of napi-rs but it's bearable
This commit is contained in:
modeco80
2024-08-20 06:14:08 -04:00
parent 55566fbd3a
commit 17191b0917
6 changed files with 257 additions and 158 deletions

View File

@@ -2,5 +2,11 @@
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
export let {guacDecode, guacEncode, jpegEncode} = require('./index.node');
let {guacDecode, guacEncodeImpl, jpegEncode} = require('./index.node');
export { guacDecode, jpegEncode };
// shim for js->rust interop, because napi-rs kind of blows in this regard
export function guacEncode(...args) {
return guacEncodeImpl(args);
}