Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title><%= title %></title>
- <link rel='stylesheet' href='/stylesheets/style.css'/>
- <script src="/javascripts/submit_javascript.js"></script>
- <script src="/javascripts/ipfsapi.min.js"></script>
- </head>
- <body>
- <h1>Welcome to the <%= title%></h1>
- <form action="#" method="post" name="form_name" id="form_id" class="form_class">
- <h2>Add Data</h2>
- <label>Name :</label>
- <input type="text" name="name" id="name" placeholder="Name"/>
- <br>
- <label>Email :</label>
- <input type="text" name="email" id="email" placeholder="Valid Email"/>
- <br>
- <input type="button" name="submit_id" id="btn_id" value="Submit by Id" onclick="submit_by_id()"/>
- </form>
- <script>
- ipfs = ipfsAPI();
- //add files
- var files = "test.json";
- ipfs.add(files, function(err, res) {
- if(err || !res) return console.error(err)
- res.forEach(function(file) {
- console.log(file.Hash)
- console.log(file.Name)
- })
- })
- //get files
- /*hashs = "QmZTkaNJgi8EoggtzAubT8qPxfhvyqVg5AUMt3ChW3hv7V";
- ipfs.cat(hashs, function(err, res) {
- if(err || !res) return console.error(err)
- if(res.readable) {
- // Returned as a stream
- res.pipe(process.stdout)
- } else {
- // Returned as a string
- console.log(res);
- }
- console.log(res.email);
- })*/
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement