# FrameReader

<div class="jsdoc-content"><header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>FrameReader<span class="signature">(body)</span><span class="type-signature"></span></h2>
        
            <div class="class-description"><p>Buffer forward reader of CQL binary frames</p></div>
        
    
</header>


    
        

    
    </div>

## Constructor

<div class="jsdoc-content">
    

    
    <h4 class="name" id="FrameReader"><span class="type-signature"></span>new FrameReader<span class="signature">(body)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Creates a new instance of the reader</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>body</code></td>
            

            <td class="type">
            
                
<span class="param-type">Buffer</span>


            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/reader.js#L7" target="_blank" rel="noopener">reader.js, line 7</a></p></div>




















    
    

    

    

    

    

    

    

    

    
        </div>

## Methods

<div class="jsdoc-content">

        
            

    

    
    <h4 class="name" id="checkOffset"><span class="type-signature"></span>checkOffset<span class="signature">(newLength)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Checks that the new length to read is within the range of the buffer length. Throws a RangeError if not.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>newLength</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/reader.js#L64" target="_blank" rel="noopener">reader.js, line 64</a></p></div>




















        
            

    

    
    <h4 class="name" id="read"><span class="type-signature"></span>read<span class="signature">(length)</span><span class="type-signature"> &rarr; {Buffer}</span></h4>
    

    



<div class="description">
    <p>Reads any number of bytes and moves the offset.
if length not provided or it's larger than the remaining bytes, reads to end.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>length</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/reader.js#L36" target="_blank" rel="noopener">reader.js, line 36</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Buffer</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="readBytes"><span class="type-signature"></span>readBytes<span class="signature">()</span><span class="type-signature"> &rarr; {Buffer}</span></h4>
    

    



<div class="description">
    <p>Reads the amount of bytes that the field has and returns them (slicing them).</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/reader.js#L76" target="_blank" rel="noopener">reader.js, line 76</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Buffer</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="readInt"><span class="type-signature"></span>readInt<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4>
    

    



<div class="description">
    <p>Reads a BE Int and moves the offset</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/reader.js#L53" target="_blank" rel="noopener">reader.js, line 53</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Number</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="slice"><span class="type-signature"></span>slice<span class="signature">(begin, end<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Buffer}</span></h4>
    

    



<div class="description">
    <p>Slices the underlying buffer</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>begin</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>end</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/reader.js#L23" target="_blank" rel="noopener">reader.js, line 23</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Buffer</span>


    </dd>
</dl></div>
