Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moving from zlib to minizlib #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/utils/miam.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ test('v1, compressed, acars, incomplete', () => {
expect(decodeResult.message.data.acars.label).toBe('H1');
expect(decodeResult.message.data.acars.sublabel).toBe('DF');
expect(decodeResult.message.data.acars.mfi).toBe(undefined);
expect(decodeResult.message.data.acars.text).toBe(undefined);
expect(decodeResult.message.data.acars.text).toBe('A350,000130,1,1,TB000000/REP019,24,02;H01,019,24,02,6400,00175,B-18910,3,0,03,11,19,08,07,01,070/H02,NZAA YBBN,CAL054 ,S');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andermatt64 added you because i wanted to make sure this is ok... i think it is, but i'm not going to pretend to know this code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

})
7 changes: 5 additions & 2 deletions lib/utils/miam.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Base85 from 'base85';
import * as Zlib from 'zlib';
import * as zlib from "minizlib";

enum MIAMFid {
SingleTransfer = 'T',
Expand Down Expand Up @@ -398,7 +398,10 @@ export class MIAMCoreUtils {
if (body !== undefined && body.length > 0) {
if ([MIAMCoreV1Compression.Deflate, MIAMCoreV2Compression.Deflate].indexOf(pduCompression) >= 0) {
try {
pduData = Zlib.inflateRawSync(body, { windowBits: 15 });
const decompress = new zlib.InflateRaw({windowBits: 15});
decompress.write(body);
decompress.flush(zlib.constants.Z_SYNC_FLUSH);
pduData = decompress.read();
} catch (e) {
pduErrors.push('Inflation failed for body: ' + e);
}
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@
"author": "Kevin Elliott <[email protected]>",
"license": "UNLICENSED",
"dependencies": {
"@types/node": "^20.11.20",
"base85": "^3.1.0"
"@types/node": "^20.11.28",
"base85": "^3.1.0",
"minizlib": "^2.1.2"
},
"devDependencies": {
"@babel/core": "^7.18.13",
"@babel/preset-env": "^7.18.10",
"@babel/preset-typescript": "^7.18.6",
"@types/jest": "^28.1.7",
"@types/minizlib": "^2.1.7",
"babel-jest": "^29.7.0",
"jest": "^28.1.3",
"ts-jest": "^28.0.8",
Expand Down
32 changes: 31 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1630,13 +1630,28 @@
expect "^28.0.0"
pretty-format "^28.0.0"

"@types/node@*", "@types/node@^20.11.20":
"@types/minizlib@^2.1.7":
version "2.1.7"
resolved "https://registry.yarnpkg.com/@types/minizlib/-/minizlib-2.1.7.tgz#7223874a8f31754a0d801cb194429b56e5ffcfaa"
integrity sha512-oKlyUX7bfj3zG6AM8rMleBHnr1X+gEx4XlQ5zByKS39gbtQmnu4nyQ3w2Agv7qinU+v8ChhFxtDUAySkCexQ+Q==
dependencies:
"@types/node" "*"
minipass "^3.3.5"

"@types/node@*":
version "20.11.25"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.25.tgz#0f50d62f274e54dd7a49f7704cc16bfbcccaf49f"
integrity sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==
dependencies:
undici-types "~5.26.4"

"@types/node@^20.11.28":
version "20.11.28"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.28.tgz#4fd5b2daff2e580c12316e457473d68f15ee6f66"
integrity sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==
dependencies:
undici-types "~5.26.4"

"@types/prettier@^2.1.5":
version "2.7.3"
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f"
Expand Down Expand Up @@ -3150,11 +3165,26 @@ minimatch@^9.0.1:
dependencies:
brace-expansion "^2.0.1"

minipass@^3.0.0, minipass@^3.3.5:
version "3.3.6"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.6.tgz#7bba384db3a1520d18c9c0e5251c3444e95dd94a"
integrity sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==
dependencies:
yallist "^4.0.0"

"minipass@^5.0.0 || ^6.0.2 || ^7.0.0":
version "7.0.4"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c"
integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==

minizlib@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931"
integrity sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==
dependencies:
minipass "^3.0.0"
yallist "^4.0.0"

[email protected]:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
Expand Down