-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
38 lines (33 loc) · 980 Bytes
/
index.html
File metadata and controls
38 lines (33 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body style="background: white;">
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<input type="text" id="fname" onchange="getText(this.value)">
<textarea id="ipfs_value"></textarea>
</body>
<script>
const IPFS = require('ipfs-core')
let ipfs
async function open_ipfs() {
ipfs = await IPFS.create();
const { cid } = await ipfs.add('Hello world')
console.log(cid)
}
async function getText(cid) {
for await (const data of ipfs.cat(cid)) {
document.getElementById('ipfs_value').innerText = data
}
}
open_ipfs()
</script>
</html>