{"action":"created","issue":{"url":"https://api.github.com/repos/svaarala/duktape/issues/190","labels_url":"https://api.github.com/repos/svaarala/duktape/issues/190/labels{/name}","comments_url":"https://api.github.com/repos/svaarala/duktape/issues/190/comments","events_url":"https://api.github.com/repos/svaarala/duktape/issues/190/events","html_url":"https://github.com/svaarala/duktape/issues/190","id":74397893,"number":190,"title":"C API changes for Node.js Buffer and TypedArray objects","user":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/svaarala/duktape/milestones/9","html_url":"https://github.com/svaarala/duktape/milestones/v1.3.0","labels_url":"https://api.github.com/repos/svaarala/duktape/milestones/9/labels","id":1037290,"number":9,"title":"v1.3.0","description":"Buffer bindings, duk_config.h, bytecode dump/load","creator":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":77,"state":"closed","created_at":"2015-03-24T22:16:58Z","updated_at":"2015-09-12T03:24:59Z","due_on":null,"closed_at":"2015-09-12T03:24:59Z"},"comments":38,"created_at":"2015-05-08T15:18:37Z","updated_at":"2015-11-10T17:47:51Z","closed_at":"2015-09-06T21:33:41Z","body":"The current C API deals with plain buffer values, e.g. `duk_is_buffer()`, `duk_get_buffer()`, and `duk_require_buffer()` all expect plain buffer values and won't work with buffer objects (Duktape.Buffer, Node.js Buffer, ArrayBuffer, TypedArray values). The same situation exists for string values: e.g. `duk_get_string()` works for a plain string but not a String object.\r\n\r\nPerhaps add a compatible extension to get the buffer data area of a plain buffer or a buffer object. There's one major difference between plain buffers and buffer objects: buffer objects support \"views/slices\" of an underlying buffer while plain buffers do not. The API call to get a buffer object's data area should take view offset/length into account so that C code would only interact with the slice active for that Buffer object.\r\n\r\n- [x] Creating buffer objects from C (instead of just plain buffers)\r\n- [x] Type checking for a buffer object - perhaps postpone to 1.4 because there's no such primitive for String objects either\r\n- [x] Consider `byte_length` argument typing for `duk_push_buffer_object()`\r\n- [x] Check .buffer of push result, at least for typed array views and DataView\r\n- [x] Getting the data area (active slice) of a buffer object from C code\r\n- [x] Note automatic ArrayBuffer creation in `duk_push_buffer_object()` API doc"},"comment":{"url":"https://api.github.com/repos/svaarala/duktape/issues/comments/155511551","html_url":"https://github.com/svaarala/duktape/issues/190#issuecomment-155511551","issue_url":"https://api.github.com/repos/svaarala/duktape/issues/190","id":155511551,"user":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"created_at":"2015-11-10T17:47:51Z","updated_at":"2015-11-10T17:47:51Z","body":"You could steal a dynamic buffer - but all of this is way too hacky IMO compared to calling Duktape.Buffer()... :)"}}