kasten-js 0.3.0 → 0.5.0

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/README.md CHANGED
@@ -6,8 +6,14 @@ TypeScript toolbox for encoding, decoding, and compression algorithms with no de
6
6
  >
7
7
  > The API can be changed in future release.
8
8
 
9
+ ## Goals
10
+
11
+ To provide several codec utility with no dependencies and simple API.
12
+
9
13
  ## Features
10
14
 
15
+ *Kasten* provides several variant of encoding, decoding and compression functionalities for JavaScript.
16
+
11
17
  - Base 64 Encoding/Decoding
12
18
  - RFC2045
13
19
  - RFC4648
@@ -17,42 +23,73 @@ TypeScript toolbox for encoding, decoding, and compression algorithms with no de
17
23
  - RFC4648 (Hex)
18
24
  - Base 16 Encoding/Decoding
19
25
  - RFC4648
20
- - (WIP)AsciiHexDecode (PDF1.7)
26
+ - AsciiHexDecode (PDF1.7)
21
27
  - Base 85
22
- - (WIP)Ascii85Decode (PDF1.7)
28
+ - Ascii85Decode (PDF1.7)
23
29
  - Run-Length Encoding/Decoding
24
30
  - Basic
25
31
  - PackBits
26
32
  - RunLengthDecode (PDF1.7)
27
- - (WIP)LZ77 Encoding/Decoding
33
+
34
+ You can uses those features by very simple API. See also [Usage](#usage) section.
35
+
36
+ Following features are currently working in progress.
37
+
38
+ Other formats can be added in future.
39
+
40
+ - Deflate
41
+ - Zstd
42
+ - Brotli
28
43
 
29
44
  ## Usage
30
45
 
31
46
  Create codec instance with static methods of `Kasten`.
32
47
 
33
48
  ```ts
49
+ import { Kasten } from 'kasten-js';
50
+
34
51
  const data: Uint8Array = ...;
35
52
 
36
- const base64 = Kasten.base64('rfc4648');
53
+ const base64 = Kasten.codecs.base64('rfc4648');
37
54
 
38
55
  const encoded: string = base64.encode(data);
39
56
 
40
57
  const decoded: Uint8Array = base64.decode(encoded);
58
+
59
+ const runLength = Kasten.compressors.runLength('pdf');
60
+
61
+ const compressed = runLength.compress(data);
62
+
63
+ const decompressed = runLength.decompress(compressed);
41
64
  ```
42
65
 
66
+ If no category specified, returns default implementation.
67
+
68
+ ```ts
69
+ import { Kasten } from 'kasten-js';
70
+
71
+ const base16 = Kasten.codecs.base16();
72
+ ```
73
+
74
+ You can get the codec implementations via `Kasten.codecs` property.
75
+
76
+ You cant get the compressor implementations via `Kasten.compressors` property.
77
+
43
78
  All codecs available in Kasten are below.
44
79
 
45
80
  |Group|Spec|Method|Category|Summary|
46
81
  |:-|:-|:-|:-|:-|
47
- |Base 64|RFC2045|`base64`|`rfc2045`|The old Base 64 specification.|
48
- |Base 64|RFC4648|`base64`|`rfc4648`|The latest Base 64 specification. It is compatible with `Uint8Array.prototype.toBase64`.|
49
- |Base 64|RFC4648(URL)|`base64`|`rfc4648-url`|The latest Base 64 specification for URL safe encoding. It is compatible with `Uint8Array.prototype.toBase64`.|
50
- |Base 32|RFC4648|`base32`|`rfc4648`|The latest Base 32 specification.|
51
- |Base 32|RFC4648 (HEX)|`base32`|`rfc4648-hex`|The latest Base 32 specification for hexadecimal encoding.|
52
- |Base 16|RFC4648|`base16`|`rfc4648`|The latest Base 16 specification.|
53
- |Run-Length|Basic|`runLength`|`basic`|The basic and old Run-Length encoding.|
54
- |Run-Length|PackBits|`runLength`|`pack-bits`|The old Run-Length encoding accepted by [MacPrint of Apple](https://web.archive.org/web/20080705155158/http://developer.apple.com/technotes/tn/tn1023.html).|
55
- |Run-Length|RunLengthDecode (PDF1.7)|`runLength`|`pdf`|The Run-Length specofication of [PDF1.7](https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf).|
82
+ |Base 64|RFC2045|`Kasten.codecs.base64`|`rfc-2045`|The old Base 64 specification.|
83
+ |Base 64|RFC4648|`Kasten.codecs.base64`|`rfc-4648`|The latest Base 64 specification. It is compatible with `Uint8Array.prototype.toBase64`.|
84
+ |Base 64|RFC4648(URL)|`Kasten.codecs.base64`|`rfc-4648-url`|The latest Base 64 specification for URL safe encoding. It is compatible with `Uint8Array.prototype.toBase64`.|
85
+ |Base 32|RFC4648|`Kasten.codecs.base32`|`rfc-4648`|The latest Base 32 specification.|
86
+ |Base 32|RFC4648 (HEX)|`Kasten.codecs.base32`|`rfc-4648-hex`|The latest Base 32 specification for hexadecimal encoding.|
87
+ |Base 16|RFC4648|`Kasten.codecs.base16`|`rfc-4648`|The latest Base 16 specification.|
88
+ |Base 16|AsciiHexDecode (PDF1.7)|`Kasten.codecs.base16`|`ascii-hex`|The Base 16 specification of PDF1.7.|
89
+ |Base 85|Ascii85Decode (PDF1.7)|`Kasten.codecs.base85`|`ascii-85`|The Base85 specification of PDF1.7.|
90
+ |Run-Length|Basic|`Kasten.compressors.runLength`|`basic`|The basic and old Run-Length encoding.|
91
+ |Run-Length|PackBits|`Kasten.compressors.runLength`|`pack-bits`|The old Run-Length encoding accepted by [MacPrint of Apple](https://web.archive.org/web/20080705155158/http://developer.apple.com/technotes/tn/tn1023.html).|
92
+ |Run-Length|RunLengthDecode (PDF1.7)|`Kasten.compressors.runLength`|`pdf`|The Run-Length specofication of PDF1.7.|
56
93
 
57
94
  ## License
58
95