@ddunigma/node 2.2.0 → 3.0.1
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 +171 -305
- package/dist/DduStream-NP3CMCKK.js +2 -0
- package/dist/chunk-FVBZKVPE.js +4 -0
- package/dist/index.cjs +5 -6
- package/dist/index.d.cts +65 -94
- package/dist/index.d.ts +65 -94
- package/dist/index.js +4 -4
- package/package.json +8 -3
- package/dist/DduStream-KO75MEEM.js +0 -2
- package/dist/chunk-CZMUPXSK.js +0 -5
package/dist/index.d.cts
CHANGED
|
@@ -2,22 +2,24 @@ import { Transform, TransformCallback, TransformOptions } from 'stream';
|
|
|
2
2
|
|
|
3
3
|
declare enum DduSetSymbol {
|
|
4
4
|
DDU = "ddu",
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
THREECHARSET = "threeCharSet"
|
|
5
|
+
DDU_V1 = "ddu_v1",
|
|
6
|
+
ONECHARSET = "oneCharSet"
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
interface CharSetConfig {
|
|
11
9
|
/** charset 식별 심볼 */
|
|
12
10
|
symbol: DduSetSymbol;
|
|
13
|
-
/** 인코딩에 사용할 문자 배열 */
|
|
11
|
+
/** 인코딩에 사용할 문자 배열 (codaChar가 있으면 기본 문자 배열) */
|
|
14
12
|
charSet: string[];
|
|
13
|
+
/** 종성 문자 배열 (charSet × codaChar 조합으로 최종 charset 생성) */
|
|
14
|
+
codaChar?: string[];
|
|
15
15
|
/** 최대 필요 문자 수 */
|
|
16
16
|
maxRequiredLength: number;
|
|
17
17
|
/** 비트 길이 (log2) */
|
|
18
18
|
bitLength: number;
|
|
19
19
|
/** 패딩 문자 */
|
|
20
20
|
paddingChar: string;
|
|
21
|
+
/** 패딩 문자 반복 방식 사용 여부 */
|
|
22
|
+
useRepeatPadding?: boolean;
|
|
21
23
|
}
|
|
22
24
|
/** 진행률 콜백 정보 */
|
|
23
25
|
interface DduProgressInfo {
|
|
@@ -47,6 +49,38 @@ interface DduEncodeStats {
|
|
|
47
49
|
/** 비트 길이 */
|
|
48
50
|
bitLength: number;
|
|
49
51
|
}
|
|
52
|
+
interface CharSetInfo {
|
|
53
|
+
/** 인코딩에 사용할 문자 배열 */
|
|
54
|
+
charSet: string[];
|
|
55
|
+
/** 패딩 문자 */
|
|
56
|
+
paddingChar: string;
|
|
57
|
+
/** 비트 길이 */
|
|
58
|
+
bitLength: number;
|
|
59
|
+
/** 2의 제곱수 charset 여부 */
|
|
60
|
+
usePowerOfTwo: boolean;
|
|
61
|
+
/** 문자열 인코딩 방식 */
|
|
62
|
+
encoding: BufferEncoding;
|
|
63
|
+
/** 기본 압축 사용 여부 */
|
|
64
|
+
defaultCompress: boolean;
|
|
65
|
+
/** 기본 최대 디코딩 바이트 수 */
|
|
66
|
+
defaultMaxDecodedBytes: number;
|
|
67
|
+
/** 기본 최대 압축해제 바이트 수 */
|
|
68
|
+
defaultMaxDecompressedBytes: number;
|
|
69
|
+
/** URL-Safe 모드 여부 */
|
|
70
|
+
urlSafe: boolean;
|
|
71
|
+
/** 암호화 키 보유 여부 */
|
|
72
|
+
hasEncryptionKey: boolean;
|
|
73
|
+
/** 기본 체크섬 사용 여부 */
|
|
74
|
+
defaultChecksum: boolean;
|
|
75
|
+
/** 기본 청크 크기 */
|
|
76
|
+
defaultChunkSize: number | undefined;
|
|
77
|
+
/** 기본 청크 구분자 */
|
|
78
|
+
defaultChunkSeparator: string;
|
|
79
|
+
/** 기본 압축 레벨 */
|
|
80
|
+
defaultCompressionLevel: number;
|
|
81
|
+
/** 기본 압축 알고리즘 */
|
|
82
|
+
defaultCompressionAlgorithm: "deflate" | "brotli";
|
|
83
|
+
}
|
|
50
84
|
interface DduOptions {
|
|
51
85
|
/** 압축 사용 여부 (zlib deflate 또는 brotli) */
|
|
52
86
|
compress?: boolean;
|
|
@@ -78,6 +112,8 @@ interface DduConstructorOptions extends DduOptions {
|
|
|
78
112
|
dduSetSymbol?: DduSetSymbol;
|
|
79
113
|
/** 커스텀 charset 문자 배열 또는 문자열 */
|
|
80
114
|
dduChar?: string[] | string;
|
|
115
|
+
/** 종성 문자 배열 (dduChar × codaChar 조합으로 최종 charset 동적 생성) */
|
|
116
|
+
codaChar?: string[];
|
|
81
117
|
/** 패딩 문자 */
|
|
82
118
|
paddingChar?: string;
|
|
83
119
|
/** 필요 문자 수 */
|
|
@@ -104,59 +140,8 @@ interface DduConstructorOptions extends DduOptions {
|
|
|
104
140
|
urlSafe?: boolean;
|
|
105
141
|
/** 암호화 키 (AES-256-GCM) */
|
|
106
142
|
encryptionKey?: string;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
declare abstract class BaseDdu {
|
|
110
|
-
protected readonly defaultEncoding: BufferEncoding;
|
|
111
|
-
/**
|
|
112
|
-
* 주어진 숫자보다 작거나 같은 가장 큰 2의 제곱수의 지수를 반환합니다.
|
|
113
|
-
* @param n - 대상 숫자
|
|
114
|
-
* @returns 2의 제곱수 지수 (예: n=8 → 3, n=64 → 6)
|
|
115
|
-
* @example getLargestPowerOfTwoExponent(8) // 3
|
|
116
|
-
* @example getLargestPowerOfTwoExponent(100) // 6
|
|
117
|
-
*/
|
|
118
|
-
protected getLargestPowerOfTwoExponent(n: number): number;
|
|
119
|
-
/**
|
|
120
|
-
* charset 크기에 필요한 비트 길이를 계산합니다.
|
|
121
|
-
* @param setLength - charset 문자 수
|
|
122
|
-
* @returns 필요한 비트 수
|
|
123
|
-
* @example getBitLength(64) // 6
|
|
124
|
-
* @example getBitLength(100) // 7
|
|
125
|
-
*/
|
|
126
|
-
protected getBitLength(setLength: number): number;
|
|
127
|
-
/**
|
|
128
|
-
* 입력 데이터를 인코딩합니다.
|
|
129
|
-
* @param input - 인코딩할 문자열 또는 Buffer
|
|
130
|
-
* @param options - 인코딩 옵션
|
|
131
|
-
* @returns 인코딩된 문자열
|
|
132
|
-
*/
|
|
133
|
-
abstract encode(input: Buffer | string, options?: DduOptions): string;
|
|
134
|
-
/**
|
|
135
|
-
* 인코딩된 문자열을 Buffer로 디코딩합니다.
|
|
136
|
-
* @param input - 인코딩된 문자열
|
|
137
|
-
* @param options - 디코딩 옵션
|
|
138
|
-
* @returns 디코딩된 Buffer
|
|
139
|
-
*/
|
|
140
|
-
abstract decodeToBuffer(input: string, options?: DduOptions): Buffer;
|
|
141
|
-
/**
|
|
142
|
-
* 인코딩된 문자열을 원본 문자열로 디코딩합니다.
|
|
143
|
-
* @param input - 인코딩된 문자열
|
|
144
|
-
* @param options - 디코딩 옵션
|
|
145
|
-
* @returns 디코딩된 문자열
|
|
146
|
-
*/
|
|
147
|
-
abstract decode(input: string, options?: DduOptions): string;
|
|
148
|
-
/**
|
|
149
|
-
* 현재 인코더의 charset 정보를 반환합니다.
|
|
150
|
-
* @returns charset 설정 정보 객체
|
|
151
|
-
*/
|
|
152
|
-
abstract getCharSetInfo(): {
|
|
153
|
-
charSet: string[];
|
|
154
|
-
paddingChar: string;
|
|
155
|
-
charLength: number;
|
|
156
|
-
bitLength: number;
|
|
157
|
-
usePowerOfTwo: boolean;
|
|
158
|
-
encoding: BufferEncoding;
|
|
159
|
-
};
|
|
143
|
+
/** 패딩 문자 반복 방식 사용 여부 */
|
|
144
|
+
useRepeatPadding?: boolean;
|
|
160
145
|
}
|
|
161
146
|
|
|
162
147
|
/**
|
|
@@ -200,13 +185,12 @@ declare class GcmDecryptStream extends Transform {
|
|
|
200
185
|
* const encoder = new Ddu64(undefined, undefined, { compress: true });
|
|
201
186
|
* const encoded = encoder.encode(longText);
|
|
202
187
|
*/
|
|
203
|
-
declare class Ddu64
|
|
188
|
+
declare class Ddu64 {
|
|
189
|
+
protected readonly defaultEncoding: BufferEncoding;
|
|
204
190
|
/** 인코딩에 사용할 문자 배열 */
|
|
205
191
|
protected readonly dduChar: string[];
|
|
206
192
|
/** 패딩 문자 */
|
|
207
193
|
protected readonly paddingChar: string;
|
|
208
|
-
/** 각 charset 문자의 길이 */
|
|
209
|
-
protected readonly charLength: number;
|
|
210
194
|
/** 비트 길이 (log2) */
|
|
211
195
|
protected readonly bitLength: number;
|
|
212
196
|
/** 2의 제곱수 charset 여부 */
|
|
@@ -245,6 +229,8 @@ declare class Ddu64 extends BaseDdu {
|
|
|
245
229
|
private readonly defaultCompressionLevel;
|
|
246
230
|
/** 기본 압축 알고리즘 */
|
|
247
231
|
private readonly defaultCompressionAlgorithm;
|
|
232
|
+
/** 패딩 문자 반복 방식 사용 여부 */
|
|
233
|
+
private readonly useRepeatPadding;
|
|
248
234
|
/**
|
|
249
235
|
* Ddu64 인코더 인스턴스를 생성합니다.
|
|
250
236
|
*
|
|
@@ -314,35 +300,24 @@ declare class Ddu64 extends BaseDdu {
|
|
|
314
300
|
*/
|
|
315
301
|
decode(input: string, options?: DduOptions): string;
|
|
316
302
|
/**
|
|
303
|
+
* @internal
|
|
317
304
|
* 공개 스트림 API의 auto-detect 경로에서 사용하는 전용 디코더입니다.
|
|
318
305
|
* 스트림 인코딩은 compress -> encrypt -> encode 순서를 사용하므로,
|
|
319
306
|
* 복원은 decode -> decrypt -> decompress 순서로 수행합니다.
|
|
320
307
|
*/
|
|
321
308
|
decodeStreamToBuffer(input: string, options?: DduOptions): Buffer;
|
|
309
|
+
/**
|
|
310
|
+
* 공통 디코딩 로직: footer 파싱 → 정렬 검증 → 크기 검증 → decodeFast
|
|
311
|
+
*/
|
|
312
|
+
private decodeRaw;
|
|
322
313
|
/**
|
|
323
314
|
* 현재 인코더의 charset 정보를 반환합니다.
|
|
324
315
|
*
|
|
325
316
|
* @returns charset 설정 정보 객체
|
|
326
317
|
*/
|
|
327
|
-
getCharSetInfo():
|
|
328
|
-
charSet: string[];
|
|
329
|
-
paddingChar: string;
|
|
330
|
-
charLength: number;
|
|
331
|
-
bitLength: number;
|
|
332
|
-
usePowerOfTwo: boolean;
|
|
333
|
-
encoding: BufferEncoding;
|
|
334
|
-
defaultCompress: boolean;
|
|
335
|
-
defaultMaxDecodedBytes: number;
|
|
336
|
-
defaultMaxDecompressedBytes: number;
|
|
337
|
-
urlSafe: boolean;
|
|
338
|
-
hasEncryptionKey: boolean;
|
|
339
|
-
defaultChecksum: boolean;
|
|
340
|
-
defaultChunkSize: number | undefined;
|
|
341
|
-
defaultChunkSeparator: string;
|
|
342
|
-
defaultCompressionLevel: number;
|
|
343
|
-
defaultCompressionAlgorithm: "deflate" | "brotli";
|
|
344
|
-
};
|
|
318
|
+
getCharSetInfo(): CharSetInfo;
|
|
345
319
|
/**
|
|
320
|
+
* @internal
|
|
346
321
|
* 외부 스트림 파이프라인에서 전처리된 Buffer를 그대로 인코딩합니다.
|
|
347
322
|
* 압축/암호화는 수행하지 않고, 마지막 푸터에만 메타데이터를 반영합니다.
|
|
348
323
|
*/
|
|
@@ -406,21 +381,27 @@ declare class Ddu64 extends BaseDdu {
|
|
|
406
381
|
*/
|
|
407
382
|
private decryptStreamData;
|
|
408
383
|
/**
|
|
384
|
+
* @internal
|
|
409
385
|
* 공개 스트림 API에서 사용할 암호화 Transform을 생성합니다.
|
|
410
386
|
*/
|
|
411
387
|
createEncryptionStream(): GcmEncryptStream | undefined;
|
|
412
388
|
/**
|
|
389
|
+
* @internal
|
|
413
390
|
* 공개 스트림 API에서 사용할 복호화 Transform을 생성합니다.
|
|
414
391
|
*/
|
|
415
392
|
createDecryptionStream(): GcmDecryptStream | undefined;
|
|
416
393
|
/**
|
|
417
|
-
*
|
|
394
|
+
* 주어진 숫자보다 작거나 같은 가장 큰 2의 제곱수의 지수를 반환합니다.
|
|
418
395
|
*/
|
|
419
|
-
private
|
|
396
|
+
private getLargestPowerOfTwoExponent;
|
|
397
|
+
/**
|
|
398
|
+
* charset 크기에 필요한 비트 길이를 계산합니다.
|
|
399
|
+
*/
|
|
400
|
+
private getBitLength;
|
|
420
401
|
/**
|
|
421
|
-
*
|
|
402
|
+
* 옵션 값을 정규화합니다.
|
|
422
403
|
*/
|
|
423
|
-
private
|
|
404
|
+
private normalizeLimit;
|
|
424
405
|
/**
|
|
425
406
|
* 디코딩 결과 바이트 수를 추정합니다.
|
|
426
407
|
*/
|
|
@@ -448,19 +429,11 @@ declare class Ddu64 extends BaseDdu {
|
|
|
448
429
|
* 일반 정수 연산을 사용한 빠른 디코딩
|
|
449
430
|
*/
|
|
450
431
|
private decodeFast;
|
|
451
|
-
/**
|
|
452
|
-
* BigInt를 사용한 대형 비트 인코딩
|
|
453
|
-
*/
|
|
454
|
-
private encodeBigInt;
|
|
455
432
|
/**
|
|
456
433
|
* 인코딩 파트 배열을 최종 문자열로 직렬화합니다.
|
|
457
434
|
* 청크 옵션이 있으면 join 후 split하는 대신 한 번에 separator를 삽입합니다.
|
|
458
435
|
*/
|
|
459
436
|
private serializeEncodedParts;
|
|
460
|
-
/**
|
|
461
|
-
* BigInt를 사용한 대형 비트 디코딩
|
|
462
|
-
*/
|
|
463
|
-
private decodeBigInt;
|
|
464
437
|
/**
|
|
465
438
|
* Charset을 정규화합니다.
|
|
466
439
|
*/
|
|
@@ -786,12 +759,10 @@ declare class DduDecodeStream extends Transform {
|
|
|
786
759
|
private encoder;
|
|
787
760
|
private options;
|
|
788
761
|
private normalizedBuffer;
|
|
789
|
-
private charLength;
|
|
790
762
|
private chunkSize;
|
|
791
763
|
private chunkSeparator;
|
|
792
764
|
private separatorTail;
|
|
793
765
|
constructor(encoder: Ddu64, options?: DduOptions & TransformOptions);
|
|
794
|
-
private calculateChunkSize;
|
|
795
766
|
_transform(chunk: Buffer, _encoding: BufferEncoding, callback: TransformCallback): void;
|
|
796
767
|
_flush(callback: TransformCallback): void;
|
|
797
768
|
private appendNormalizedChunk;
|
|
@@ -810,4 +781,4 @@ declare function createEncodeStream(encoder: Ddu64, options?: DduOptions & Trans
|
|
|
810
781
|
*/
|
|
811
782
|
declare function createDecodeStream(encoder: Ddu64, options?: DduOptions & TransformOptions): NodeJS.ReadWriteStream;
|
|
812
783
|
|
|
813
|
-
export {
|
|
784
|
+
export { type CharSetConfig, type CharSetInfo, CharsetBuilder, Ddu64, type DduConstructorOptions, DduDecodeStream, type DduEncodeStats, DduEncodeStream, type DduOptions, DduPipeline, type DduProgressInfo, DduSetSymbol, createDecodeStream, createEncodeStream };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,22 +2,24 @@ import { Transform, TransformCallback, TransformOptions } from 'stream';
|
|
|
2
2
|
|
|
3
3
|
declare enum DduSetSymbol {
|
|
4
4
|
DDU = "ddu",
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
THREECHARSET = "threeCharSet"
|
|
5
|
+
DDU_V1 = "ddu_v1",
|
|
6
|
+
ONECHARSET = "oneCharSet"
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
interface CharSetConfig {
|
|
11
9
|
/** charset 식별 심볼 */
|
|
12
10
|
symbol: DduSetSymbol;
|
|
13
|
-
/** 인코딩에 사용할 문자 배열 */
|
|
11
|
+
/** 인코딩에 사용할 문자 배열 (codaChar가 있으면 기본 문자 배열) */
|
|
14
12
|
charSet: string[];
|
|
13
|
+
/** 종성 문자 배열 (charSet × codaChar 조합으로 최종 charset 생성) */
|
|
14
|
+
codaChar?: string[];
|
|
15
15
|
/** 최대 필요 문자 수 */
|
|
16
16
|
maxRequiredLength: number;
|
|
17
17
|
/** 비트 길이 (log2) */
|
|
18
18
|
bitLength: number;
|
|
19
19
|
/** 패딩 문자 */
|
|
20
20
|
paddingChar: string;
|
|
21
|
+
/** 패딩 문자 반복 방식 사용 여부 */
|
|
22
|
+
useRepeatPadding?: boolean;
|
|
21
23
|
}
|
|
22
24
|
/** 진행률 콜백 정보 */
|
|
23
25
|
interface DduProgressInfo {
|
|
@@ -47,6 +49,38 @@ interface DduEncodeStats {
|
|
|
47
49
|
/** 비트 길이 */
|
|
48
50
|
bitLength: number;
|
|
49
51
|
}
|
|
52
|
+
interface CharSetInfo {
|
|
53
|
+
/** 인코딩에 사용할 문자 배열 */
|
|
54
|
+
charSet: string[];
|
|
55
|
+
/** 패딩 문자 */
|
|
56
|
+
paddingChar: string;
|
|
57
|
+
/** 비트 길이 */
|
|
58
|
+
bitLength: number;
|
|
59
|
+
/** 2의 제곱수 charset 여부 */
|
|
60
|
+
usePowerOfTwo: boolean;
|
|
61
|
+
/** 문자열 인코딩 방식 */
|
|
62
|
+
encoding: BufferEncoding;
|
|
63
|
+
/** 기본 압축 사용 여부 */
|
|
64
|
+
defaultCompress: boolean;
|
|
65
|
+
/** 기본 최대 디코딩 바이트 수 */
|
|
66
|
+
defaultMaxDecodedBytes: number;
|
|
67
|
+
/** 기본 최대 압축해제 바이트 수 */
|
|
68
|
+
defaultMaxDecompressedBytes: number;
|
|
69
|
+
/** URL-Safe 모드 여부 */
|
|
70
|
+
urlSafe: boolean;
|
|
71
|
+
/** 암호화 키 보유 여부 */
|
|
72
|
+
hasEncryptionKey: boolean;
|
|
73
|
+
/** 기본 체크섬 사용 여부 */
|
|
74
|
+
defaultChecksum: boolean;
|
|
75
|
+
/** 기본 청크 크기 */
|
|
76
|
+
defaultChunkSize: number | undefined;
|
|
77
|
+
/** 기본 청크 구분자 */
|
|
78
|
+
defaultChunkSeparator: string;
|
|
79
|
+
/** 기본 압축 레벨 */
|
|
80
|
+
defaultCompressionLevel: number;
|
|
81
|
+
/** 기본 압축 알고리즘 */
|
|
82
|
+
defaultCompressionAlgorithm: "deflate" | "brotli";
|
|
83
|
+
}
|
|
50
84
|
interface DduOptions {
|
|
51
85
|
/** 압축 사용 여부 (zlib deflate 또는 brotli) */
|
|
52
86
|
compress?: boolean;
|
|
@@ -78,6 +112,8 @@ interface DduConstructorOptions extends DduOptions {
|
|
|
78
112
|
dduSetSymbol?: DduSetSymbol;
|
|
79
113
|
/** 커스텀 charset 문자 배열 또는 문자열 */
|
|
80
114
|
dduChar?: string[] | string;
|
|
115
|
+
/** 종성 문자 배열 (dduChar × codaChar 조합으로 최종 charset 동적 생성) */
|
|
116
|
+
codaChar?: string[];
|
|
81
117
|
/** 패딩 문자 */
|
|
82
118
|
paddingChar?: string;
|
|
83
119
|
/** 필요 문자 수 */
|
|
@@ -104,59 +140,8 @@ interface DduConstructorOptions extends DduOptions {
|
|
|
104
140
|
urlSafe?: boolean;
|
|
105
141
|
/** 암호화 키 (AES-256-GCM) */
|
|
106
142
|
encryptionKey?: string;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
declare abstract class BaseDdu {
|
|
110
|
-
protected readonly defaultEncoding: BufferEncoding;
|
|
111
|
-
/**
|
|
112
|
-
* 주어진 숫자보다 작거나 같은 가장 큰 2의 제곱수의 지수를 반환합니다.
|
|
113
|
-
* @param n - 대상 숫자
|
|
114
|
-
* @returns 2의 제곱수 지수 (예: n=8 → 3, n=64 → 6)
|
|
115
|
-
* @example getLargestPowerOfTwoExponent(8) // 3
|
|
116
|
-
* @example getLargestPowerOfTwoExponent(100) // 6
|
|
117
|
-
*/
|
|
118
|
-
protected getLargestPowerOfTwoExponent(n: number): number;
|
|
119
|
-
/**
|
|
120
|
-
* charset 크기에 필요한 비트 길이를 계산합니다.
|
|
121
|
-
* @param setLength - charset 문자 수
|
|
122
|
-
* @returns 필요한 비트 수
|
|
123
|
-
* @example getBitLength(64) // 6
|
|
124
|
-
* @example getBitLength(100) // 7
|
|
125
|
-
*/
|
|
126
|
-
protected getBitLength(setLength: number): number;
|
|
127
|
-
/**
|
|
128
|
-
* 입력 데이터를 인코딩합니다.
|
|
129
|
-
* @param input - 인코딩할 문자열 또는 Buffer
|
|
130
|
-
* @param options - 인코딩 옵션
|
|
131
|
-
* @returns 인코딩된 문자열
|
|
132
|
-
*/
|
|
133
|
-
abstract encode(input: Buffer | string, options?: DduOptions): string;
|
|
134
|
-
/**
|
|
135
|
-
* 인코딩된 문자열을 Buffer로 디코딩합니다.
|
|
136
|
-
* @param input - 인코딩된 문자열
|
|
137
|
-
* @param options - 디코딩 옵션
|
|
138
|
-
* @returns 디코딩된 Buffer
|
|
139
|
-
*/
|
|
140
|
-
abstract decodeToBuffer(input: string, options?: DduOptions): Buffer;
|
|
141
|
-
/**
|
|
142
|
-
* 인코딩된 문자열을 원본 문자열로 디코딩합니다.
|
|
143
|
-
* @param input - 인코딩된 문자열
|
|
144
|
-
* @param options - 디코딩 옵션
|
|
145
|
-
* @returns 디코딩된 문자열
|
|
146
|
-
*/
|
|
147
|
-
abstract decode(input: string, options?: DduOptions): string;
|
|
148
|
-
/**
|
|
149
|
-
* 현재 인코더의 charset 정보를 반환합니다.
|
|
150
|
-
* @returns charset 설정 정보 객체
|
|
151
|
-
*/
|
|
152
|
-
abstract getCharSetInfo(): {
|
|
153
|
-
charSet: string[];
|
|
154
|
-
paddingChar: string;
|
|
155
|
-
charLength: number;
|
|
156
|
-
bitLength: number;
|
|
157
|
-
usePowerOfTwo: boolean;
|
|
158
|
-
encoding: BufferEncoding;
|
|
159
|
-
};
|
|
143
|
+
/** 패딩 문자 반복 방식 사용 여부 */
|
|
144
|
+
useRepeatPadding?: boolean;
|
|
160
145
|
}
|
|
161
146
|
|
|
162
147
|
/**
|
|
@@ -200,13 +185,12 @@ declare class GcmDecryptStream extends Transform {
|
|
|
200
185
|
* const encoder = new Ddu64(undefined, undefined, { compress: true });
|
|
201
186
|
* const encoded = encoder.encode(longText);
|
|
202
187
|
*/
|
|
203
|
-
declare class Ddu64
|
|
188
|
+
declare class Ddu64 {
|
|
189
|
+
protected readonly defaultEncoding: BufferEncoding;
|
|
204
190
|
/** 인코딩에 사용할 문자 배열 */
|
|
205
191
|
protected readonly dduChar: string[];
|
|
206
192
|
/** 패딩 문자 */
|
|
207
193
|
protected readonly paddingChar: string;
|
|
208
|
-
/** 각 charset 문자의 길이 */
|
|
209
|
-
protected readonly charLength: number;
|
|
210
194
|
/** 비트 길이 (log2) */
|
|
211
195
|
protected readonly bitLength: number;
|
|
212
196
|
/** 2의 제곱수 charset 여부 */
|
|
@@ -245,6 +229,8 @@ declare class Ddu64 extends BaseDdu {
|
|
|
245
229
|
private readonly defaultCompressionLevel;
|
|
246
230
|
/** 기본 압축 알고리즘 */
|
|
247
231
|
private readonly defaultCompressionAlgorithm;
|
|
232
|
+
/** 패딩 문자 반복 방식 사용 여부 */
|
|
233
|
+
private readonly useRepeatPadding;
|
|
248
234
|
/**
|
|
249
235
|
* Ddu64 인코더 인스턴스를 생성합니다.
|
|
250
236
|
*
|
|
@@ -314,35 +300,24 @@ declare class Ddu64 extends BaseDdu {
|
|
|
314
300
|
*/
|
|
315
301
|
decode(input: string, options?: DduOptions): string;
|
|
316
302
|
/**
|
|
303
|
+
* @internal
|
|
317
304
|
* 공개 스트림 API의 auto-detect 경로에서 사용하는 전용 디코더입니다.
|
|
318
305
|
* 스트림 인코딩은 compress -> encrypt -> encode 순서를 사용하므로,
|
|
319
306
|
* 복원은 decode -> decrypt -> decompress 순서로 수행합니다.
|
|
320
307
|
*/
|
|
321
308
|
decodeStreamToBuffer(input: string, options?: DduOptions): Buffer;
|
|
309
|
+
/**
|
|
310
|
+
* 공통 디코딩 로직: footer 파싱 → 정렬 검증 → 크기 검증 → decodeFast
|
|
311
|
+
*/
|
|
312
|
+
private decodeRaw;
|
|
322
313
|
/**
|
|
323
314
|
* 현재 인코더의 charset 정보를 반환합니다.
|
|
324
315
|
*
|
|
325
316
|
* @returns charset 설정 정보 객체
|
|
326
317
|
*/
|
|
327
|
-
getCharSetInfo():
|
|
328
|
-
charSet: string[];
|
|
329
|
-
paddingChar: string;
|
|
330
|
-
charLength: number;
|
|
331
|
-
bitLength: number;
|
|
332
|
-
usePowerOfTwo: boolean;
|
|
333
|
-
encoding: BufferEncoding;
|
|
334
|
-
defaultCompress: boolean;
|
|
335
|
-
defaultMaxDecodedBytes: number;
|
|
336
|
-
defaultMaxDecompressedBytes: number;
|
|
337
|
-
urlSafe: boolean;
|
|
338
|
-
hasEncryptionKey: boolean;
|
|
339
|
-
defaultChecksum: boolean;
|
|
340
|
-
defaultChunkSize: number | undefined;
|
|
341
|
-
defaultChunkSeparator: string;
|
|
342
|
-
defaultCompressionLevel: number;
|
|
343
|
-
defaultCompressionAlgorithm: "deflate" | "brotli";
|
|
344
|
-
};
|
|
318
|
+
getCharSetInfo(): CharSetInfo;
|
|
345
319
|
/**
|
|
320
|
+
* @internal
|
|
346
321
|
* 외부 스트림 파이프라인에서 전처리된 Buffer를 그대로 인코딩합니다.
|
|
347
322
|
* 압축/암호화는 수행하지 않고, 마지막 푸터에만 메타데이터를 반영합니다.
|
|
348
323
|
*/
|
|
@@ -406,21 +381,27 @@ declare class Ddu64 extends BaseDdu {
|
|
|
406
381
|
*/
|
|
407
382
|
private decryptStreamData;
|
|
408
383
|
/**
|
|
384
|
+
* @internal
|
|
409
385
|
* 공개 스트림 API에서 사용할 암호화 Transform을 생성합니다.
|
|
410
386
|
*/
|
|
411
387
|
createEncryptionStream(): GcmEncryptStream | undefined;
|
|
412
388
|
/**
|
|
389
|
+
* @internal
|
|
413
390
|
* 공개 스트림 API에서 사용할 복호화 Transform을 생성합니다.
|
|
414
391
|
*/
|
|
415
392
|
createDecryptionStream(): GcmDecryptStream | undefined;
|
|
416
393
|
/**
|
|
417
|
-
*
|
|
394
|
+
* 주어진 숫자보다 작거나 같은 가장 큰 2의 제곱수의 지수를 반환합니다.
|
|
418
395
|
*/
|
|
419
|
-
private
|
|
396
|
+
private getLargestPowerOfTwoExponent;
|
|
397
|
+
/**
|
|
398
|
+
* charset 크기에 필요한 비트 길이를 계산합니다.
|
|
399
|
+
*/
|
|
400
|
+
private getBitLength;
|
|
420
401
|
/**
|
|
421
|
-
*
|
|
402
|
+
* 옵션 값을 정규화합니다.
|
|
422
403
|
*/
|
|
423
|
-
private
|
|
404
|
+
private normalizeLimit;
|
|
424
405
|
/**
|
|
425
406
|
* 디코딩 결과 바이트 수를 추정합니다.
|
|
426
407
|
*/
|
|
@@ -448,19 +429,11 @@ declare class Ddu64 extends BaseDdu {
|
|
|
448
429
|
* 일반 정수 연산을 사용한 빠른 디코딩
|
|
449
430
|
*/
|
|
450
431
|
private decodeFast;
|
|
451
|
-
/**
|
|
452
|
-
* BigInt를 사용한 대형 비트 인코딩
|
|
453
|
-
*/
|
|
454
|
-
private encodeBigInt;
|
|
455
432
|
/**
|
|
456
433
|
* 인코딩 파트 배열을 최종 문자열로 직렬화합니다.
|
|
457
434
|
* 청크 옵션이 있으면 join 후 split하는 대신 한 번에 separator를 삽입합니다.
|
|
458
435
|
*/
|
|
459
436
|
private serializeEncodedParts;
|
|
460
|
-
/**
|
|
461
|
-
* BigInt를 사용한 대형 비트 디코딩
|
|
462
|
-
*/
|
|
463
|
-
private decodeBigInt;
|
|
464
437
|
/**
|
|
465
438
|
* Charset을 정규화합니다.
|
|
466
439
|
*/
|
|
@@ -786,12 +759,10 @@ declare class DduDecodeStream extends Transform {
|
|
|
786
759
|
private encoder;
|
|
787
760
|
private options;
|
|
788
761
|
private normalizedBuffer;
|
|
789
|
-
private charLength;
|
|
790
762
|
private chunkSize;
|
|
791
763
|
private chunkSeparator;
|
|
792
764
|
private separatorTail;
|
|
793
765
|
constructor(encoder: Ddu64, options?: DduOptions & TransformOptions);
|
|
794
|
-
private calculateChunkSize;
|
|
795
766
|
_transform(chunk: Buffer, _encoding: BufferEncoding, callback: TransformCallback): void;
|
|
796
767
|
_flush(callback: TransformCallback): void;
|
|
797
768
|
private appendNormalizedChunk;
|
|
@@ -810,4 +781,4 @@ declare function createEncodeStream(encoder: Ddu64, options?: DduOptions & Trans
|
|
|
810
781
|
*/
|
|
811
782
|
declare function createDecodeStream(encoder: Ddu64, options?: DduOptions & TransformOptions): NodeJS.ReadWriteStream;
|
|
812
783
|
|
|
813
|
-
export {
|
|
784
|
+
export { type CharSetConfig, type CharSetInfo, CharsetBuilder, Ddu64, type DduConstructorOptions, DduDecodeStream, type DduEncodeStats, DduEncodeStream, type DduOptions, DduPipeline, type DduProgressInfo, DduSetSymbol, createDecodeStream, createEncodeStream };
|