Atom eve seo

This commit is contained in:
2026-07-15 18:08:51 +02:00
parent 48e9e2992c
commit 7b81464a1d
665 changed files with 219503 additions and 894 deletions

Binary file not shown.

View File

@@ -0,0 +1,55 @@
'use strict';
const { promisify } = require('util');
const { isUint8Array } = require('util/types');
function load() {
try {
return require('../build/Release/zstd.node');
} catch {
// Webpack will fail when just returning the require, so we need to wrap
// in a try/catch and rethrow.
/* eslint no-useless-catch: 0 */
try {
return require('../build/Debug/zstd.node');
} catch (error) {
throw error;
}
}
}
const zstd = load();
const _compress = promisify(zstd.compress);
const _decompress = promisify(zstd.decompress);
// Error objects created via napi don't have JS stacks; wrap them so .stack is present
// https://github.com/nodejs/node/issues/25318#issuecomment-451068073
exports.compress = async function compress(data, compressionLevel) {
if (!isUint8Array(data)) {
throw new TypeError(`parameter 'data' must be a Uint8Array.`);
}
if (compressionLevel != null && typeof compressionLevel !== 'number') {
throw new TypeError(`parameter 'compressionLevel' must be a number.`);
}
try {
return await _compress(data, compressionLevel ?? 3);
} catch (e) {
throw new Error(`zstd: ${e.message}`);
}
};
exports.decompress = async function decompress(data) {
if (!isUint8Array(data)) {
throw new TypeError(`parameter 'data' must be a Uint8Array.`);
}
try {
return await _decompress(data);
} catch (e) {
throw new Error(`zstd: ${e.message}`);
}
};
/** used for testing */
exports.getDefinedNapiVersion = zstd.getDefinedNapiVersion;

View File

@@ -0,0 +1,51 @@
{
"name": "@mongodb-js/zstd",
"version": "7.0.0",
"main": "lib/index.js",
"types": "index.d.ts",
"repository": "https://github.com/mongodb-js/zstd",
"files": [
"index.d.ts",
"lib/index.js",
"addon/*",
"binding.gyp"
],
"dependencies": {
"node-addon-api": "^8.5.0",
"prebuild-install": "^7.1.3"
},
"license": "Apache-2.0",
"devDependencies": {
"@mongodb-js/zstd": "^1.2.0",
"@typescript-eslint/eslint-plugin": "^8.46.0",
"@wasm-fmt/clang-format": "^21.1.4",
"chai": "^4.5.0",
"eslint": "^9.37.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"mocha": "^11.7.4",
"node-gyp": "^11.4.2",
"prebuild": "^13.0.1",
"prettier": "^3.6.2"
},
"engines": {
"node": ">= 20.19.0"
},
"scripts": {
"install": "prebuild-install --runtime napi || npm run clean-install",
"clean-install": "npm run install-zstd && npm run compile",
"compile": "node-gyp rebuild",
"test": "mocha test/*.js",
"install-zstd": "bash etc/install-zstd.sh",
"check:eslint": "ESLINT_USE_FLAT_CONFIG=false eslint *ts lib/*.js test/*.js .*.json",
"clang-format": "clang-format --style=file:.clang-format --Werror -i addon/*",
"check:clang-format": "clang-format --style=file:.clang-format --dry-run --Werror addon/*",
"prebuild": "prebuild --runtime napi --strip --verbose --all"
},
"binary": {
"napi_versions": [
9
]
},
"mongodb:zstd_version": "1.5.6"
}