{"action":"created","issue":{"url":"https://api.github.com/repos/ipfs/examples/issues/17","repository_url":"https://api.github.com/repos/ipfs/examples","labels_url":"https://api.github.com/repos/ipfs/examples/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/ipfs/examples/issues/17/comments","events_url":"https://api.github.com/repos/ipfs/examples/issues/17/events","html_url":"https://github.com/ipfs/examples/issues/17","id":92923864,"number":17,"title":"New Example: create and read ipfs files in browser","user":{"login":"carver","id":205327,"avatar_url":"https://avatars.githubusercontent.com/u/205327?v=3","gravatar_id":"","url":"https://api.github.com/users/carver","html_url":"https://github.com/carver","followers_url":"https://api.github.com/users/carver/followers","following_url":"https://api.github.com/users/carver/following{/other_user}","gists_url":"https://api.github.com/users/carver/gists{/gist_id}","starred_url":"https://api.github.com/users/carver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carver/subscriptions","organizations_url":"https://api.github.com/users/carver/orgs","repos_url":"https://api.github.com/users/carver/repos","events_url":"https://api.github.com/users/carver/events{/privacy}","received_events_url":"https://api.github.com/users/carver/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-03T19:11:46Z","updated_at":"2016-06-10T06:30:50Z","closed_at":null,"body":"Note to self.  Something like:\r\n\r\n\r\nWrite this to index.js\r\n```javascript\r\nvar ipfs = require('ipfs-api')();\r\n\r\nfunction store() {\r\n  var toStore = document.getElementById('source').value;\r\n  //TODO un-break this call:\r\n  ipfs.add(new Buffer(toStore), function (err, res){\r\n    if(err || !res) return console.error(\"ipfs add error\", err, res);\r\n\r\n    res.forEach(function(file) {\r\n      console.log('successfully stored', file.Hash);\r\n      display(file.Hash); \r\n    });\r\n  });\r\n}\r\n\r\nfunction display(hash) {\r\n  ipfs.cat(hash, function(err, res) {\r\n    if(err || !res) return console.error(\"ipfs cat error\", err, res);\r\n    if(res.readable) {\r\n      console.error('unhandled: cat result is a pipe', res);\r\n    } else {\r\n      document.getElementById('hash').innerText=hash;\r\n      document.getElementById('content').innerText=res;\r\n    }\r\n  });\r\n}\r\n\r\ndocument.getElementById('store').onclick=store;\r\n```\r\n\r\n```bash\r\n#sloppy html demo\r\necho '<textarea id=\"source\"></textarea>\r\n<button id=\"store\">create in ipfs</button>\r\n<div><div>found in ipfs:</div>\r\n<div id=\"hash\">[ipfs hash]</div>\r\n<div id=\"content\">[ipfs content]</div></div>\r\n<script type=\"text/javascript\" src=\"ipfs.js\"></script>' > index.html\r\n\r\n#file server\r\nsudo npm install -g browserify http-server\r\nnpm install ipfs-api\r\nbrowserify index.js > ipfs.js #do this every time you change index.js, or better: set up grunt watch\r\nhttp-server -a 127.0.0.1 -p 8888\r\n\r\n#ipfs server\r\nexport API_ORIGIN=\"http://localhost:8888\"\r\nipfs daemon\r\n```\r\n\r\nOpen [http://localhost:8888/index.html](http://localhost:8888/index.html)"},"comment":{"url":"https://api.github.com/repos/ipfs/examples/issues/comments/225103995","html_url":"https://github.com/ipfs/examples/issues/17#issuecomment-225103995","issue_url":"https://api.github.com/repos/ipfs/examples/issues/17","id":225103995,"user":{"login":"aniket-kumar","id":19814736,"avatar_url":"https://avatars.githubusercontent.com/u/19814736?v=3","gravatar_id":"","url":"https://api.github.com/users/aniket-kumar","html_url":"https://github.com/aniket-kumar","followers_url":"https://api.github.com/users/aniket-kumar/followers","following_url":"https://api.github.com/users/aniket-kumar/following{/other_user}","gists_url":"https://api.github.com/users/aniket-kumar/gists{/gist_id}","starred_url":"https://api.github.com/users/aniket-kumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aniket-kumar/subscriptions","organizations_url":"https://api.github.com/users/aniket-kumar/orgs","repos_url":"https://api.github.com/users/aniket-kumar/repos","events_url":"https://api.github.com/users/aniket-kumar/events{/privacy}","received_events_url":"https://api.github.com/users/aniket-kumar/received_events","type":"User","site_admin":false},"created_at":"2016-06-10T06:30:50Z","updated_at":"2016-06-10T06:30:50Z","body":"@carver any help would be appreciated."}}
{"actor":{"display_login":"aniket-kumar"}}