Advertisement
Guest User

Untitled

a guest
Aug 8th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title><%= title %></title>
  5. <link rel='stylesheet' href='/stylesheets/style.css'/>
  6. <script src="/javascripts/submit_javascript.js"></script>
  7. <script src="/javascripts/ipfsapi.min.js"></script>
  8. </head>
  9. <body>
  10. <h1>Welcome to the <%= title%></h1>
  11.  
  12. <form action="#" method="post" name="form_name" id="form_id" class="form_class">
  13. <h2>Add Data</h2>
  14. <label>Name :</label>
  15. <input type="text" name="name" id="name" placeholder="Name"/>
  16. <br>
  17. <label>Email :</label>
  18. <input type="text" name="email" id="email" placeholder="Valid Email"/>
  19. <br>
  20. <input type="button" name="submit_id" id="btn_id" value="Submit by Id" onclick="submit_by_id()"/>
  21. </form>
  22.  
  23. <script>
  24. ipfs = ipfsAPI();
  25.  
  26. //add files
  27. var files = "test.json";
  28. ipfs.add(files, function(err, res) {
  29. if(err || !res) return console.error(err)
  30.  
  31. res.forEach(function(file) {
  32. console.log(file.Hash)
  33. console.log(file.Name)
  34. })
  35. })
  36.  
  37. //get files
  38. /*hashs = "QmZTkaNJgi8EoggtzAubT8qPxfhvyqVg5AUMt3ChW3hv7V";
  39. ipfs.cat(hashs, function(err, res) {
  40. if(err || !res) return console.error(err)
  41.  
  42. if(res.readable) {
  43. // Returned as a stream
  44. res.pipe(process.stdout)
  45. } else {
  46. // Returned as a string
  47. console.log(res);
  48. }
  49. console.log(res.email);
  50. })*/
  51.  
  52. </script>
  53. </body>
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement