Socket
Socket
Sign inDemoInstall

cids

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cids - npm Package Compare versions

Comparing version 0.7.2 to 0.7.3

16

CHANGELOG.md

@@ -0,1 +1,17 @@

<a name="0.7.3"></a>
## [0.7.3](https://github.com/multiformats/js-cid/compare/v0.7.2...v0.7.3) (2020-01-24)
### Bug Fixes
* address review requests + ordering ([29e2def](https://github.com/multiformats/js-cid/commit/29e2def))
* update toString to include optional base ([5aff196](https://github.com/multiformats/js-cid/commit/5aff196))
### Features
* more correct type defs + docs ([4eb0c60](https://github.com/multiformats/js-cid/commit/4eb0c60))
<a name="0.7.2"></a>

@@ -2,0 +18,0 @@ ## [0.7.2](https://github.com/multiformats/js-cid/compare/v0.7.1...v0.7.2) (2020-01-14)

2

package.json
{
"name": "cids",
"version": "0.7.2",
"version": "0.7.3",
"description": "CID Implementation in JavaScript",

@@ -5,0 +5,0 @@ "leadMaintainer": "Volker Mische <volker.mische@gmail.com>",

@@ -1,29 +0,118 @@

export type Version = 0 | 1
export type Codec = string
export type Multihash = Buffer
export type BaseEncodedString = string
export type MultibaseName = string
/**
* Class representing a CID `<mbase><version><mcodec><mhash>`
* , as defined in [ipld/cid](https://github.com/multiformats/cid).
*/
declare class CID {
/**
* Create a new CID.
*
* The algorithm for argument input is roughly:
* ```
* if (cid)
* -> create a copy
* else if (str)
* if (1st char is on multibase table) -> CID String
* else -> bs58 encoded multihash
* else if (Buffer)
* if (1st byte is 0 or 1) -> CID
* else -> multihash
* else if (Number)
* -> construct CID by parts
* ```
*
* @example
* new CID(<version>, <codec>, <multihash>, <multibaseName>)
* new CID(<cidStr>)
* new CID(<cid.buffer>)
* new CID(<multihash>)
* new CID(<bs58 encoded multihash>)
* new CID(<cid>)
*/
constructor(
version: 0 | 1,
codec: string,
multhash: Buffer,
multibaseName?: string
);
constructor(cid: CID);
constructor(str: string);
constructor(buf: Buffer);
export class CID {
constructor(version: Version, codec: Codec, multhash: Multihash, multibaseName?: MultibaseName)
constructor(cidStr: BaseEncodedString)
constructor(cidBuf: Buffer)
constructor(cidMultihash: Multihash)
constructor(cid: CID)
codec: Codec
multihash: Multihash
buffer: Buffer
prefix: Buffer
version: number
toV0(): CID
toV1(): CID
toBaseEncodedString(base?: string): BaseEncodedString
toString(): BaseEncodedString
toJSON(): { codec: Codec, version: Version, hash: Multihash }
equals(other: any): boolean
static codecs: Record<Codec, Buffer>
static isCID(mixed: any): boolean
static validateCID(other: any): void
/**
* The version of the CID.
*/
version: number;
/**
* The codec of the CID.
*/
codec: string;
/**
* The multihash of the CID.
*/
multihash: Buffer;
/**
* Multibase name as string.
*/
multibaseName: string;
/**
* The CID as a `Buffer`
*/
readonly buffer: Buffer;
/**
* The prefix of the CID.
*/
readonly prefix: Buffer;
/**
* Convert to a CID of version `0`.
*/
toV0(): CID;
/**
* Convert to a CID of version `1`.
*/
toV1(): CID;
/**
* Encode the CID into a string.
*
* @param base Base encoding to use.
*/
toBaseEncodedString(base?: string): string;
/**
* Encode the CID into a string.
*/
toString(base?: string): string;
/**
* Serialize to a plain object.
*/
toJSON(): { codec: string; version: 0 | 1; hash: Buffer };
/**
* Compare equality with another CID.
*
* @param other The other CID.
*/
equals(other: any): boolean;
/**
* Test if the given input is a valid CID object.
* Throws if it is not.
*
* @param other The other CID.
*/
static validateCID(other: any): void;
static isCID(mixed: any): boolean;
static codecs: Record<string, number>;
}
export default CID
export = CID

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc