multiformats 1.0.2 copy "multiformats: ^1.0.2" to clipboard
multiformats: ^1.0.2 copied to clipboard

Core library for parsing IPFS-related things. This package is mainly used by https://atprotodart.com packages.

multiformats

Core library for parsing IPFS-related things 🦋

1. Guide 🌎 #

This library provides the easiest way to use v1 CID and other IPFS things in Dart and Flutter apps.

1.1. Getting Started ⚡ #

1.1.1. Install Library #

With Dart:

 dart pub add multiformats

Or With Flutter:

 flutter pub add multiformats

1.1.2. Import #

import 'package:multiformats/multiformats.dart';

1.1.3. Implementation #

import 'package:multiformats/multiformats.dart';

import 'data.dart';

void main() {
  final cid1 = CID.parse(stringCid);
  final cid2 = CID.fromList(bytesCid);

  cid1 == cid2; // => true
  cid1.bytes; // => [0, 1, 85, 18, 32, 74, 151, 6, 128, 21, 242, 234, 243, 211, 164, 189, 89, 87, 0, 221, 71, 37, 76, 57, 227, 138, 247, 144, 216, 78, 220, 12, 83, 136, 10, 62, 117]
  cid2.toString(); // => bafkreicks4diafps5lz5hjf5lflqbxkhevgdty4k66inqtw4brjyqcr6ou

  final cid3 = CID.fromJson({
    '/': stringCid,
  });

  cid3 == cid1 && cid3 == cid2; // => true
  cid3.toJson(); // => {"/": "bafkreicks4diafps5lz5hjf5lflqbxkhevgdty4k66inqtw4brjyqcr6ou"}

  final cid4 = CID.create('hello world');

  cid4.toString(); // => bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e
}
2
likes
160
points
5.03k
downloads

Publisher

verified publisheratprotodart.com

Weekly Downloads

Core library for parsing IPFS-related things. This package is mainly used by https://atprotodart.com packages.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#ipfs #atproto #bluesky #cid

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

BSD-3-Clause (license)

Dependencies

base_codecs, crypto, dart_multihash

More

Packages that depend on multiformats