{"action":"created","issue":{"url":"https://api.github.com/repos/tessel/t2-cli/issues/231","labels_url":"https://api.github.com/repos/tessel/t2-cli/issues/231/labels{/name}","comments_url":"https://api.github.com/repos/tessel/t2-cli/issues/231/comments","events_url":"https://api.github.com/repos/tessel/t2-cli/issues/231/events","html_url":"https://github.com/tessel/t2-cli/pull/231","id":97257870,"number":231,"title":"[WIP] t2 update","user":{"login":"johnnyman727","id":432909,"avatar_url":"https://avatars.githubusercontent.com/u/432909?v=3","gravatar_id":"","url":"https://api.github.com/users/johnnyman727","html_url":"https://github.com/johnnyman727","followers_url":"https://api.github.com/users/johnnyman727/followers","following_url":"https://api.github.com/users/johnnyman727/following{/other_user}","gists_url":"https://api.github.com/users/johnnyman727/gists{/gist_id}","starred_url":"https://api.github.com/users/johnnyman727/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnnyman727/subscriptions","organizations_url":"https://api.github.com/users/johnnyman727/orgs","repos_url":"https://api.github.com/users/johnnyman727/repos","events_url":"https://api.github.com/users/johnnyman727/events{/privacy}","received_events_url":"https://api.github.com/users/johnnyman727/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-07-25T21:21:39Z","updated_at":"2015-08-12T07:19:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tessel/t2-cli/pulls/231","html_url":"https://github.com/tessel/t2-cli/pull/231","diff_url":"https://github.com/tessel/t2-cli/pull/231.diff","patch_url":"https://github.com/tessel/t2-cli/pull/231.patch"},"body":"- [x] Controller logic for parsing args and starting updates\r\n- [x] Fetch current firmware/openWRT image version\r\n- [x] Update openWRT image\r\n- [x] Update SAMD21 image\r\n- [ ] Actually fetch from AWS instead of locally\r\n- [ ] Refactor to be able to switch between LAN and USB for a given Tessel\r\n- [ ] Rename Tessel back to the original name after update completes\r\n- [ ] Reprovision Tessel if it was privisioned prior to update\r\n- [ ] Polish logging, error message, tests, etc."},"comment":{"url":"https://api.github.com/repos/tessel/t2-cli/issues/comments/130196806","html_url":"https://github.com/tessel/t2-cli/pull/231#issuecomment-130196806","issue_url":"https://api.github.com/repos/tessel/t2-cli/issues/231","id":130196806,"user":{"login":"LinusU","id":189580,"avatar_url":"https://avatars.githubusercontent.com/u/189580?v=3","gravatar_id":"","url":"https://api.github.com/users/LinusU","html_url":"https://github.com/LinusU","followers_url":"https://api.github.com/users/LinusU/followers","following_url":"https://api.github.com/users/LinusU/following{/other_user}","gists_url":"https://api.github.com/users/LinusU/gists{/gist_id}","starred_url":"https://api.github.com/users/LinusU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LinusU/subscriptions","organizations_url":"https://api.github.com/users/LinusU/orgs","repos_url":"https://api.github.com/users/LinusU/repos","events_url":"https://api.github.com/users/LinusU/events{/privacy}","received_events_url":"https://api.github.com/users/LinusU/received_events","type":"User","site_admin":false},"created_at":"2015-08-12T07:19:43Z","updated_at":"2015-08-12T07:19:43Z","body":"I think that the problem is that it's a gziped tar stream. You need to first pass it thru `Gunzip` (see `zlib` builtin module in Node.js).\r\n\r\nAlso, please don't buffer the entire body and then pass it thru to tar-stream. That would be an unnecessary speed and memory impact.\r\n\r\nSomething like this should work:\r\n\r\n```javascript\r\nvar req = request.get('https://s3.amazonaws.com/builds.tessel.io/t2/firmware/9a85c84f5a03c715908921baaaa9e7397985bc7f.tar.gz')\r\nvar gunzip = zlib.createGunzip()\r\nvar extract = tar.extract()\r\n\r\nextract.on('entry', function (header, stream, callback) {\r\n  // Check header.name, decide what to do\r\n})\r\n\r\nreq.pipe(gunzip).pipe(extract)\r\n```"}}