@@ -28,85 +28,91 @@ declare class CID {
28
28
* new CID(<bs58 encoded multihash>)
29
29
* new CID(<cid>)
30
30
*/
31
- constructor ( version : 0 | 1 , codec : string , multhash : Buffer , multibaseName ?: string )
32
- constructor ( cidStr : string )
33
- constructor ( cidBuf : Buffer )
34
- constructor ( cidMultihash : Buffer )
35
- constructor ( cid : CID )
36
-
31
+ constructor (
32
+ version : 0 | 1 ,
33
+ codec : string ,
34
+ multhash : Buffer ,
35
+ multibaseName ?: string
36
+ ) ;
37
+ constructor ( cid : CID ) ;
38
+ constructor ( str : string ) ;
39
+ constructor ( buf : Buffer ) ;
40
+
41
+ /**
42
+ * The version of the CID.
43
+ */
44
+ version : number ;
45
+
37
46
/**
38
47
* The codec of the CID.
39
48
*/
40
- codec : string
49
+ codec : string ;
41
50
42
51
/**
43
52
* The multihash of the CID.
44
53
*/
45
- multihash : Buffer
54
+ multihash : Buffer ;
46
55
47
56
/**
48
57
* Multibase name as string.
49
58
*/
50
- multibaseName : string
59
+ multibaseName : string ;
51
60
52
61
/**
53
62
* The CID as a `Buffer`
54
63
*/
55
- readonly buffer : Buffer
56
-
57
- /**
58
- * The prefix of the CID.
59
- */
60
- readonly prefix : Buffer
64
+ readonly buffer : Buffer ;
61
65
62
66
/**
63
- * The version of the CID.
67
+ * The prefix of the CID.
64
68
*/
65
- version : number
69
+ readonly prefix : Buffer ;
66
70
67
71
/**
68
72
* Convert to a CID of version `0`.
69
73
*/
70
- toV0 ( ) : CID
74
+ toV0 ( ) : CID ;
71
75
72
76
/**
73
77
* Convert to a CID of version `1`.
74
78
*/
75
- toV1 ( ) : CID
79
+ toV1 ( ) : CID ;
80
+
76
81
/**
77
82
* Encode the CID into a string.
78
83
*
79
84
* @param base Base encoding to use.
80
85
*/
81
- toBaseEncodedString ( base ?: string ) : string
86
+ toBaseEncodedString ( base ?: string ) : string ;
82
87
83
88
/**
84
89
* Encode the CID into a string.
85
90
*/
86
- toString ( base ?: string ) : string
91
+ toString ( base ?: string ) : string ;
87
92
88
93
/**
89
94
* Serialize to a plain object.
90
95
*/
91
- toJSON ( ) : { codec : string , version : 0 | 1 , hash : Buffer }
92
-
96
+ toJSON ( ) : { codec : string ; version : 0 | 1 ; hash : Buffer } ;
97
+
93
98
/**
94
99
* Compare equality with another CID.
95
100
*
96
101
* @param other The other CID.
97
102
*/
98
- equals ( other : any ) : boolean
99
-
100
- static codecs : Record < string , Buffer >
101
- static isCID ( mixed : any ) : boolean
103
+ equals ( other : any ) : boolean ;
102
104
103
105
/**
104
106
* Test if the given input is a valid CID object.
105
107
* Throws if it is not.
106
108
*
107
109
* @param other The other CID.
108
110
*/
109
- static validateCID ( other : any ) : void
111
+ static validateCID ( other : any ) : void ;
112
+
113
+ static isCID ( mixed : any ) : boolean ;
114
+
115
+ static codecs : Record < string , number > ;
110
116
}
111
117
112
118
export = CID
0 commit comments