Naughty Programmer's Madness
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

y-ipfs

0.1.0 • Public • Published

y-ipfs

IPFS Connector for Yjs

Use it!

Retrieve this with npm:

$ npm install y-ipfs --save

Example

const IPFS = require('ipfs')
const Y = require('yjs')
 
// create IPFS node
const ipfs = new IPFS({
  config: {
    Addresses: {
      Swarm: [
        '/libp2p-webrtc-star/dns4/star-signal.cloud.ipfs.team/wss'
      ]
    }
  },
  EXPERIMENTAL: {
    pubsub: true // need this to work
  }
})
 
Y({
  db: {
    name: 'memory'
  },
  connector: {
    name: 'ipfs', // use the IPFS connector
    ipfs: ipfs,
    room: 'Textarea-example-dev'
  },
  sourceDir: '/bower_components', // location of the y-* modules
  share: {
    textarea: 'Text' // y.share.textarea is of type Y.Text
  }
}).then(function (y) {
  // bind the textarea to a shared text element
  y.share.textarea.bind(document.getElementById('textfield'))
}

Debug

Activate y-ipfs on debug to see log messages.

License

MIT

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

License

MIT

Keywords

none

install

npm i y-ipfs

Downloadsweekly downloads

2

version

0.1.0

license

MIT

repository

githubgithub

last publish

collaborators

  • avatar