An open API service indexing awesome lists of open source software.

https://github.com/chancehudson/cidbadge

svg badges for ipfs content identifiers
https://github.com/chancehudson/cidbadge

Last synced: 5 months ago
JSON representation

svg badges for ipfs content identifiers

Awesome Lists containing this project

README

          

# cidbadge

Generate svg badges for IPFS content identifiers.

## Example Use

Install with `npm install --save cidbadge`.

```js
import cidbadge from 'cidbadge';

// the cid to render
const cid = 'QmWiNATFRiqGd1daYhno5DuHRCgJivQrRSToKW18GsHf9e';
// options are optional, only cid is required
const options = {
targetLength: 12,
href: `https://ipfs.io/ipfs/${cid}`
};
// Generated svg string
const svg = cidbadge(cid, options);
console.log(svg);
```

This will output the following svg text:

```svg
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n cid\n cid\n QmWiNA...8GsHf9\n QmWiNA...8GsHf9\n \n \n
```

Renders as the following:
![](https://raw.githubusercontent.com/JChanceHud/cidbadge/master/badge.svg?sanitize=true)

## CLI Use

`npx cidbadge /ipfs/QmWiNATFRiqGd1daYhno5DuHRCgJivQrRSToKW18GsHf9e ./badge.svg`

```
Usage: cidbadge

Outputs an SVG badge with the cid text supplied.
```

## License
MIT