{"action":"created","issue":{"url":"https://api.github.com/repos/mtth/avsc/issues/58","repository_url":"https://api.github.com/repos/mtth/avsc","labels_url":"https://api.github.com/repos/mtth/avsc/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/mtth/avsc/issues/58/comments","events_url":"https://api.github.com/repos/mtth/avsc/issues/58/events","html_url":"https://github.com/mtth/avsc/issues/58","id":164443689,"number":58,"title":"ArrayBuffer to Buffer not working","user":{"login":"miguelmota","id":168240,"avatar_url":"https://avatars.githubusercontent.com/u/168240?v=3","gravatar_id":"","url":"https://api.github.com/users/miguelmota","html_url":"https://github.com/miguelmota","followers_url":"https://api.github.com/users/miguelmota/followers","following_url":"https://api.github.com/users/miguelmota/following{/other_user}","gists_url":"https://api.github.com/users/miguelmota/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelmota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelmota/subscriptions","organizations_url":"https://api.github.com/users/miguelmota/orgs","repos_url":"https://api.github.com/users/miguelmota/repos","events_url":"https://api.github.com/users/miguelmota/events{/privacy}","received_events_url":"https://api.github.com/users/miguelmota/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-08T01:48:00Z","updated_at":"2016-07-08T16:23:11Z","closed_at":"2016-07-08T15:00:40Z","body":"```javascript\r\nconst avro = require('avsc');\r\n\r\nconst type = avro.parse({\r\n  name: 'Pet',\r\n  type: 'record',\r\n  fields: [\r\n    {name: 'kind', type: {name: 'Kind', type: 'enum', symbols: ['CAT', 'DOG']}},\r\n    {name: 'name', type: 'string'},\r\n  ]\r\n});\r\n\r\nconst buf = type.toBuffer({\r\n  kind: 'CAT',\r\n  name: 'Bob'\r\n});\r\n\r\nconst arrayBuffer = buf.buffer;\r\nconst newBuf = new Buffer(arrayBuffer);\r\n\r\nconst val = type.fromBuffer(newBuf);\r\n\r\nconsole.log(val);\r\n```\r\n\r\noutput\r\n\r\n```bash\r\n/Users/mota/Sandbox/avro-demo/node_modules/avsc/lib/types.js:1337\r\n    throw new Error(f('invalid %s enum index: %s', this._name, index));\r\n    ^\r\n\r\nError: invalid Kind enum index: -50\r\n    at EnumType._read (/Users/mota/Sandbox/avro-demo/node_modules/avsc/lib/types.js:1337:11)\r\n    at RecordType.readPet [as _read] (eval at <anonymous> (/Users/mota/Sandbox/avro-demo/node_modules/avsc/lib/types.js:1957:10), <anonymous>:5:8)\r\n    at readValue (/Users/mota/Sandbox/avro-demo/node_modules/avsc/lib/types.js:2471:17)\r\n    at RecordType.Type.fromBuffer (/Users/mota/Sandbox/avro-demo/node_modules/avsc/lib/types.js:305:13)\r\n    at Object.<anonymous> (/Users/mota/Sandbox/avro-demo/index.js:20:18)\r\n    at Module._compile (module.js:541:32)\r\n    at Object.Module._extensions..js (module.js:550:10)\r\n    at Module.load (module.js:456:32)\r\n    at tryModuleLoad (module.js:415:12)\r\n    at Function.Module._load (module.js:407:3)\r\n```"},"comment":{"url":"https://api.github.com/repos/mtth/avsc/issues/comments/231404828","html_url":"https://github.com/mtth/avsc/issues/58#issuecomment-231404828","issue_url":"https://api.github.com/repos/mtth/avsc/issues/58","id":231404828,"user":{"login":"miguelmota","id":168240,"avatar_url":"https://avatars.githubusercontent.com/u/168240?v=3","gravatar_id":"","url":"https://api.github.com/users/miguelmota","html_url":"https://github.com/miguelmota","followers_url":"https://api.github.com/users/miguelmota/followers","following_url":"https://api.github.com/users/miguelmota/following{/other_user}","gists_url":"https://api.github.com/users/miguelmota/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelmota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelmota/subscriptions","organizations_url":"https://api.github.com/users/miguelmota/orgs","repos_url":"https://api.github.com/users/miguelmota/repos","events_url":"https://api.github.com/users/miguelmota/events{/privacy}","received_events_url":"https://api.github.com/users/miguelmota/received_events","type":"User","site_admin":false},"created_at":"2016-07-08T16:23:11Z","updated_at":"2016-07-08T16:23:11Z","body":"@mtth thanks for the clarification!"}}
{"actor":{"display_login":"miguelmota"}}