npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ipfs-observed-remove-map

v0.7.8

Published

[![CircleCI](https://circleci.com/gh/wehriam/ipfs-observed-remove-map.svg?style=svg)](https://circleci.com/gh/wehriam/ipfs-observed-remove-map) [![npm version](https://badge.fury.io/js/ipfs-observed-remove-map.svg)](http://badge.fury.io/js/ipfs-observed-r

Readme

IPFS Observed Remove Map

CircleCI npm version codecov

Eventually-consistent, conflict-free replicated data type (CRDT) implemented using IPFS PubSub and extending the observed remove map module.

This module and the IPFS PubSub system are experimental. If you encounter an issue, fork the repository, write tests demonstrating the issue, and create a pull request.

const ipfsAPI = require('ipfs-api');
const { IpfsOrMap } = require('ipfs-observed-remove-map');

// IPFS nodes with PubSub enabled
const ipfs1 = ipfsAPI('/ip4/127.0.0.1/tcp/5001'); 
const ipfs2 = ipfsAPI('/ip4/127.0.0.1/tcp/5002');

const topic = "CRDT";

const map1 = new IpfsOrMap(ipfs1, topic);
const map2 = new IpfsOrMap(ipfs2, topic);

// Callback when values change
map1.on('set', (key, value) => {
  map1.get('A'); // Returns 1
});

map2.set('A', 1);

Install

yarn add ipfs-observed-remove-map

IPFS-based API

new IpfsOrMap(ipfs, ipfsTopic, uuid)

Create a new IPFS-based observed remove map.

Required ipfs is any Javascript object implementing the core IPFS API , most likely a js-ipfs or js-ipfs-api object.

Required ipfsTopic is a string representing the IPFS pubsub topic the client should subscribe to.

Optional uuid is some universally unique identifer string for this instance.

ipfsOrMap.setIpfsSyncTimeout()

Broadcasts the IPFS hash of the key-value pairs, triggering a 'hard' sync of all nodes.

ipfsOrMap.getIpfsHash()

Returns a promise which resolves to the IPFS hash string of the key-value pairs.

ipfsOrMap.waitForIpfsPeers()

Returns a promise which resolves when the ipfsTopic topic has peers. Useful for testing.

ipfsOrMap.ipfsPeerCount()

Returns a promise which resolves with the number of ipfsTopic topic peers.

Core observed-remove-map API

ipfsOrMap.add(key)

Add a key to the map with a value of null.

element is any serializable Javascript object. Changes to within this object will NOT be replicated.

ipfsOrMap.delete(key)

Remove a key and it's value from the map.

ipfsOrMap.set(key, value)

Sets the value at key. If key does not exist, it will be added first.

ipfsOrMap.get(key)

Returns the value associated with the given key.

ipfsOrMap.keys()

Returns an array with all keys.

ipfsOrMap.values()

Returns an array with all values.

ipfsOrMap.receive(op)

Receive an operation from a remote map. Must be called exactly once per remote operation.

ipfsOrMap.on('op', function (op) {})

Fires when an operation needs to be sent to connected Maps. Operations should be delivered in the order they are emitted and must be delivered exactly once. There may be multiple operation events for each call to a method.

op is the operation object that needs to be passed into otherOrMap.receive(op) for all other replicas.

ipfsOrMap.on('add', function (key) {})

Fires when a new key is added to the map by a remote operation. (will not fire when ipfsOrMap.add() is called locally.)

ipfsOrMap.on('delete', function (key, value) {})

Fires when a key is removed from the map by a remote operation. (will not fire when ipfsOrMap.delete() is called locally.)

ipfsOrMap.on('set', function (key, value) {})

Fires when the value associated with a key is changed by a remote operation. (will not fire when ipfsOrMap.set() is called locally.)