1 | // Type definitions for lz-string 1.3
|
2 | // Project: https://github.com/pieroxy/lz-string, http://pieroxy.net/blog/pages/lz-string/index.html
|
3 | // Definitions by: Roman Nikitin <https://github.com/M0ns1gn0r>
|
4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
5 |
|
6 | declare var LZString: LZString.LZStringStatic;
|
7 | export = LZString;
|
8 | export as namespace LZString;
|
9 |
|
10 | declare namespace LZString {
|
11 | /**
|
12 | * LZ-based compression algorithm for JavaScript.
|
13 | */
|
14 | interface LZStringStatic {
|
15 | /**
|
16 | * Compresses input string producing an instance of an "invalid" UTF-16 string.
|
17 | * Such string could be stored in localStorage only on webkit
|
18 | * browsers (tested on Android, Chrome, Safari).
|
19 | *
|
20 | * @param uncompressed A string which should be compressed.
|
21 | */
|
22 | compress(uncompressed: string): string;
|
23 |
|
24 | /**
|
25 | * Decompresses "invalid" input string created by the method compress().
|
26 | *
|
27 | * @param compressed A string obtained from a call to compress().
|
28 | */
|
29 | decompress(compressed: string): null | string;
|
30 |
|
31 | /**
|
32 | * Compresses input string producing an instance of a "valid" UTF-16 string,
|
33 | * in the sense that all browsers can store them safely.
|
34 | *
|
35 | * @param uncompressed A string which should be compressed.
|
36 | */
|
37 | compressToUTF16(uncompressed: string): string;
|
38 |
|
39 | /**
|
40 | * Decompresses "valid" input string created by the method compressToUTF16().
|
41 | *
|
42 | * @param compressed A string obtained from a call to compressToUTF16().
|
43 | */
|
44 | decompressFromUTF16(compressed: string): null | string;
|
45 |
|
46 | /**
|
47 | * Compresses input string producing an instance of a ASCII UTF-16 string,
|
48 | * which represents the original string encoded in Base64.
|
49 | * The result can be safely transported outside the browser with a
|
50 | * guarantee that none of the characters produced need to be URL-encoded.
|
51 | *
|
52 | * @param uncompressed A string which should be compressed.
|
53 | */
|
54 | compressToBase64(uncompressed: string): string;
|
55 |
|
56 | /**
|
57 | * Decompresses ASCII UTF-16 input string created by the method compressToBase64().
|
58 | *
|
59 | * @param compressed A string obtained from a call to compressToBase64().
|
60 | */
|
61 | decompressFromBase64(compressed: string): null | string;
|
62 |
|
63 | /**
|
64 | * produces ASCII strings representing the original string encoded in Base64 with a few
|
65 | * tweaks to make these URI safe. Hence, you can send them to the server without thinking
|
66 | * about URL encoding them. This saves bandwidth and CPU
|
67 | *
|
68 | * @param uncompressed A string which should be compressed.
|
69 | */
|
70 | compressToEncodedURIComponent(uncompressed: string): string;
|
71 |
|
72 | /**
|
73 | * Decompresses "valid" input string created by the method compressToEncodedURIComponent().
|
74 | *
|
75 | * @param compressed A string obtained from a call to compressToEncodedURIComponent().
|
76 | */
|
77 | decompressFromEncodedURIComponent(compressed: string): null | string;
|
78 |
|
79 | /**
|
80 | * produces an uint8Array
|
81 | *
|
82 | * @param uncompressed A string which should be compressed.
|
83 | */
|
84 | compressToUint8Array(uncompressed: string): Uint8Array;
|
85 |
|
86 | /**
|
87 | * Decompresses "valid" array created by the method compressToUint8Array().
|
88 | *
|
89 | * @param compressed A string obtained from a call to compressToUint8Array().
|
90 | */
|
91 | decompressFromUint8Array(compressed: Uint8Array): null | string;
|
92 | }
|
93 | }
|