@rxdi/compressor 0.7.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +9 -0
- package/README.md +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -0
- package/dist/lzw.d.ts +4 -0
- package/dist/lzw.js +21 -0
- package/gapi-cli.conf.yml +15 -0
- package/package.json +73 -0
package/.travis.yml
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @rxdi/compressor
|
|
2
|
+
|
|
3
|
+
##### Install
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @rxdi/compressor
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Consuming
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { LZWService } from '@rxdi/compressor';
|
|
13
|
+
|
|
14
|
+
const myObject = { name: 'Kristiyan Tachev' }
|
|
15
|
+
const compressed = LZWService.compress(myObject)
|
|
16
|
+
|
|
17
|
+
const decompressed = LZWService.decompress(compressed);
|
|
18
|
+
/* Prints: { name: 'Kristiyan Tachev' } */
|
|
19
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./lzw";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./lzw"), exports);
|
package/dist/lzw.d.ts
ADDED
package/dist/lzw.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LZWService = void 0;
|
|
4
|
+
const msgpack = require("msgpack5");
|
|
5
|
+
const nodeLzw = require("node-lzw");
|
|
6
|
+
const safe64 = require("urlsafe-base64");
|
|
7
|
+
class LZWService {
|
|
8
|
+
static compress(object) {
|
|
9
|
+
const packed = msgpack().encode(object);
|
|
10
|
+
const compressed = Buffer.from(nodeLzw.encode(packed.toString("binary")));
|
|
11
|
+
const encoded = safe64.encode(compressed);
|
|
12
|
+
return encoded;
|
|
13
|
+
}
|
|
14
|
+
static decompress(string) {
|
|
15
|
+
const decoded = safe64.decode(string);
|
|
16
|
+
const decompressed = Buffer.from(nodeLzw.decode(decoded), "binary");
|
|
17
|
+
const unpacked = msgpack().decode(decompressed);
|
|
18
|
+
return unpacked;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.LZWService = LZWService;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
commands:
|
|
3
|
+
testing:
|
|
4
|
+
browser: jest --env jsdom --testPathPattern="/src/.*\\.browser.spec.(ts|tsx|js)$"
|
|
5
|
+
node: jest --env node --testPathPattern="/src/.*\\.spec.(ts|tsx|js)$"
|
|
6
|
+
build:
|
|
7
|
+
core:
|
|
8
|
+
- tsc
|
|
9
|
+
- find . -not -path "./node_modules/*" -type f -iname \*.js -delete
|
|
10
|
+
- parcel build --target node development/index.ts
|
|
11
|
+
- cp -r dist/index.js index.js
|
|
12
|
+
- gapi build clean
|
|
13
|
+
clean:
|
|
14
|
+
- rm -rf dist
|
|
15
|
+
- rm -rf .cache
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rxdi/compressor",
|
|
3
|
+
"version": "0.7.118",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/rxdi/rxdi-monorepo"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"typings": "./dist/index.d.ts",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "jest | true",
|
|
14
|
+
"build": "tsc || true",
|
|
15
|
+
"lint": "tslint -c tslint.json 'src/**/*.{ts,tsx}'",
|
|
16
|
+
"pretest": "npm run lint"
|
|
17
|
+
},
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Kristian Tachev(Stradivario)",
|
|
20
|
+
"email": "kristiqn.tachev@gmail.com"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"graphql",
|
|
24
|
+
"gapi",
|
|
25
|
+
"node"
|
|
26
|
+
],
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/rxdi/rxdi-monorepo/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/rxdi/rxdi-monorepo#readme",
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"msgpack5": "^5.3.1",
|
|
34
|
+
"node-lzw": "^0.3.1",
|
|
35
|
+
"urlsafe-base64": "^1.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/graphql": "^14.5.0",
|
|
39
|
+
"@types/hapi": "^18.0.4",
|
|
40
|
+
"@types/jest": "^24.0.22",
|
|
41
|
+
"@types/node": "^12.0.10",
|
|
42
|
+
"jest": "^24.8.0",
|
|
43
|
+
"jest-cli": "^24.8.1",
|
|
44
|
+
"ts-jest": "^24.0.2",
|
|
45
|
+
"tslint": "^5.20.1",
|
|
46
|
+
"tslint-language-service": "^0.9.9",
|
|
47
|
+
"typescript": "^3.9.3"
|
|
48
|
+
},
|
|
49
|
+
"jest": {
|
|
50
|
+
"testEnvironment": "node",
|
|
51
|
+
"testPathIgnorePatterns": [
|
|
52
|
+
"/node_modules/"
|
|
53
|
+
],
|
|
54
|
+
"coverageReporters": [
|
|
55
|
+
"lcov",
|
|
56
|
+
"html"
|
|
57
|
+
],
|
|
58
|
+
"rootDir": "./",
|
|
59
|
+
"moduleFileExtensions": [
|
|
60
|
+
"ts",
|
|
61
|
+
"tsx",
|
|
62
|
+
"js",
|
|
63
|
+
"json",
|
|
64
|
+
"node"
|
|
65
|
+
],
|
|
66
|
+
"transform": {
|
|
67
|
+
"\\.(ts|tsx)$": "ts-jest"
|
|
68
|
+
},
|
|
69
|
+
"testRegex": "/src/.*\\.spec.(ts|tsx|js)$",
|
|
70
|
+
"verbose": true,
|
|
71
|
+
"collectCoverage": true
|
|
72
|
+
}
|
|
73
|
+
}
|