{"action":"closed","issue":{"url":"https://api.github.com/repos/michael/github/issues/137","labels_url":"https://api.github.com/repos/michael/github/issues/137/labels{/name}","comments_url":"https://api.github.com/repos/michael/github/issues/137/comments","events_url":"https://api.github.com/repos/michael/github/issues/137/events","html_url":"https://github.com/michael/github/issues/137","id":51002671,"number":137,"title":"RangeError: Maximum call stack size exceeded.","user":{"login":"smakinson","id":16784,"avatar_url":"https://avatars.githubusercontent.com/u/16784?v=3","gravatar_id":"","url":"https://api.github.com/users/smakinson","html_url":"https://github.com/smakinson","followers_url":"https://api.github.com/users/smakinson/followers","following_url":"https://api.github.com/users/smakinson/following{/other_user}","gists_url":"https://api.github.com/users/smakinson/gists{/gist_id}","starred_url":"https://api.github.com/users/smakinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smakinson/subscriptions","organizations_url":"https://api.github.com/users/smakinson/orgs","repos_url":"https://api.github.com/users/smakinson/repos","events_url":"https://api.github.com/users/smakinson/events{/privacy}","received_events_url":"https://api.github.com/users/smakinson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/michael/github/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/michael/github/labels/priority%202%20(high)","name":"priority 2 (high)","color":"c7def8"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/michael/github/milestones/1","html_url":"https://github.com/michael/github/milestones/v0.10.8","labels_url":"https://api.github.com/repos/michael/github/milestones/1/labels","id":1360478,"number":1,"title":"v0.10.8","description":"This will integrate a number of improvements while improving test coverage. It will be released once coverage is above 95%.","creator":{"login":"aendrew","id":185041,"avatar_url":"https://avatars.githubusercontent.com/u/185041?v=3","gravatar_id":"","url":"https://api.github.com/users/aendrew","html_url":"https://github.com/aendrew","followers_url":"https://api.github.com/users/aendrew/followers","following_url":"https://api.github.com/users/aendrew/following{/other_user}","gists_url":"https://api.github.com/users/aendrew/gists{/gist_id}","starred_url":"https://api.github.com/users/aendrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aendrew/subscriptions","organizations_url":"https://api.github.com/users/aendrew/orgs","repos_url":"https://api.github.com/users/aendrew/repos","events_url":"https://api.github.com/users/aendrew/events{/privacy}","received_events_url":"https://api.github.com/users/aendrew/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":19,"state":"open","created_at":"2015-10-17T01:09:11Z","updated_at":"2016-01-23T16:41:45Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2014-12-04T17:20:12Z","updated_at":"2016-01-23T16:41:45Z","closed_at":"2016-01-23T16:41:45Z","body":"I am using your lib to upload images to github and I came across this error \"RangeError: Maximum call stack size exceeded.\" in chrome & safari when uploading. I found this discussion:\r\n\r\nhttp://stackoverflow.com/questions/3195865/converting-byte-array-to-string-in-javascript\r\n\r\nand I tried the suggestion in lovasoa's toBinString function and changed the code around line 366 from:\r\n\r\ncontent = {\r\n              \"content\": btoa(String.fromCharCode.apply(null, new Uint8Array(content))),\r\n              \"encoding\": \"base64\"\r\n};\r\n\r\nto\r\n\r\nvar uarr = new Uint8Array(content);\r\nvar strings = [], chunksize = 0xffff;\r\nvar len = uarr.length;\r\n\r\n// There is a maximum stack size. We cannot call String.fromCharCode with as many arguments as we want\r\nfor (var i = 0; i * chunksize < len; i++){\r\n    strings.push(String.fromCharCode.apply(null, uarr.subarray(i * chunksize, (i + 1) * chunksize)));\r\n}\r\n\r\ncontent = {\r\n    \"content\": btoa(strings.join('')),\r\n    \"encoding\": \"base64\"\r\n};\r\n\r\nIt seems to work now. I have not done tons of testing, but I thought I'd file a bug if someone has some time to check it out."}}