This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +14
-62862
lines changed
examples/browser-add-file Expand file tree Collapse file tree 6 files changed +14
-62862
lines changed Original file line number Diff line number Diff line change 3
3
< head >
4
4
< meta charset ="UTF-8 "/>
5
5
< title > JS IPFS API - Example - Browser - Add</ title >
6
- < script src ="scripts/buffer.js "> </ script > <!-- feross buffer -->
7
- < script src ="scripts/ipfs.js " > </ script > <!-- js- ipfs-api/dist/index.js -- >
6
+ < script src ="https://wzrd.in/standalone/buffer "> </ script > <!-- feross buffer -->
7
+ < script src ="https://npmcdn.com/ ipfs-api/dist/index.js" > </ script >
8
8
< script src ="index.js "> </ script >
9
9
</ head >
10
10
< body >
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
1
3
var ipfs = window . IpfsApi ( )
2
4
3
5
function storeText ( ) {
4
- store ( document . getElementById ( 'source' ) . value ) ;
6
+ store ( document . getElementById ( 'source' ) . value )
5
7
}
6
8
7
9
function storeFile ( ) {
8
- const file = document . getElementById ( 'filePicker' ) . files [ 0 ] ;
9
- const reader = new FileReader ( ) ;
10
- reader . onload = function ( ) {
11
- store ( reader . result ) ;
10
+ const file = document . getElementById ( 'filePicker' ) . files [ 0 ]
11
+ const reader = new FileReader ( )
12
+ reader . onload = function ( ) {
13
+ store ( reader . result )
12
14
} ;
13
- reader . readAsArrayBuffer ( file ) ;
15
+ reader . readAsArrayBuffer ( file )
14
16
}
15
17
16
18
// from examples/browser-add
@@ -41,7 +43,7 @@ function display (hash) {
41
43
} )
42
44
}
43
45
44
- document . addEventListener ( 'DOMContentLoaded' , function ( ) {
45
- document . getElementById ( 'storeText' ) . onclick = storeText ;
46
- document . getElementById ( 'storeBuffer' ) . onclick = storeFile ;
46
+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
47
+ document . getElementById ( 'storeText' ) . onclick = storeText
48
+ document . getElementById ( 'storeBuffer' ) . onclick = storeFile
47
49
} )
Original file line number Diff line number Diff line change 4
4
"description" : " " ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
- "start" : " http-server -p 8888"
7
+ "start" : " http-server -a 127.0.0.1 - p 8888"
8
8
},
9
9
"keywords" : [],
10
10
"author" : " nycoliver" ,
You can’t perform that action at this time.
0 commit comments