'use strict' const IPFS = require('ipfs') function App() { let node create() function create() { node = new IPFS() node.on('ready', () => { console.log('IPFS node is ready') console.log('loading IPFS content for ' + window.location.pathname) // Load the page contents for the IPFS hash. node.files.cat(window.location.pathname, (err, file) => { if (err) { throw err } var iframe = document.createElement('iframe') iframe.style = 'width: 100%; height: 100%; border: 0; overflow: hidden' iframe.src = URL.createObjectURL(new Blob([file])) document.body.appendChild(iframe) }) }) } } module.exports = App App()