You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.6 KiB

<h1 id="bufferobjects">Buffer objects</h1>
<h2>Overview of buffer types</h2>
<p>Duktape provides the following buffer and buffer-related types:</p>
<ul>
<li>Plain buffer value</li>
<li>Duktape.Buffer object</li>
<li>Node.js Buffer object</li>
<li>ArrayBuffer object</li>
<li>DataView and TypedArray views</li>
</ul>
<p>See <a href="https://github.com/svaarala/duktape/blob/master/doc/buffers.rst">buffers.rst</a>
for detailed discussion.</p>
<h2>Property summary</h2>
<p>See <a href="https://github.com/svaarala/duktape/blob/master/doc/buffers.rst">buffers.rst</a>.</p>
<h2>Buffers in Ecmascript code</h2>
<p>See <a href="https://github.com/svaarala/duktape/blob/master/doc/buffers.rst">buffers.rst</a>.</p>
<h2>Buffers in C code</h2>
<p>Duktape API calls prior to 1.3 deal with plain buffer values only.
To avoid incompatible changes in Duktape 1.3, separate API calls have
been added to deal with any buffer-like values, including both plain
buffers and buffer objects. API calls dealing with buffer objects have
been tagged <code>bufferobject</code> in the API documentation:</p>
<ul>
<li><code><a href="api.html#taglist-bufferobject">bufferobject</a></code> API calls</li>
</ul>
<p>The following test case illustrates basic buffer object use from C code:</p>
<ul>
<li><a href="https://github.com/svaarala/duktape/blob/master/tests/api/test-bufferobject-example-1.c">test-bufferobject-example-1.c</a></li>
</ul>
<h2>Current limitations</h2>
<ul>
<li>See <a href="#typedarray-custombehavior">TypedArray binding</a> custom
behavior.</li>
<li>See <a href="#nodejsbuffer-custombehavior">Node.js Buffer binding</a> custom
behavior.</li>
</ul>