This repository has been archived on 2023-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
intergalactic/src/index.js

32 lines
796 B
JavaScript

'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()