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

Readme

Keywords

none

Package Sidebar

Install

npm i y-ipfs

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • pgte