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
- Host: GitHub
- URL: https://github.com/chancehudson/cidbadge
- Owner: chancehudson
- Created: 2019-01-15T11:05:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-08T02:03:24.000Z (almost 5 years ago)
- Last Synced: 2025-11-23T22:02:55.591Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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:

## CLI Use
`npx cidbadge /ipfs/QmWiNATFRiqGd1daYhno5DuHRCgJivQrRSToKW18GsHf9e ./badge.svg`
```
Usage: cidbadge
Outputs an SVG badge with the cid text supplied.
```
## License
MIT