My "ref" module has a "reinterpret()"[1] function which takes a Buffer
instance and returns a new Buffer instance that points to the same
memory address, but has an arbitrary "length" that you specify. This
is both dangerous and necessary sometimes when dealing with ffi stuff.

[1]: http://tootallnate.github.com/ref/#exports-reinterpret

On Sat, Sep 1, 2012 at 10:11 AM, Seiji Sam Lee <[email protected]> wrote:
> too much slow!!
>
> El sábado, 1 de septiembre de 2012 19:09:17 UTC+2, Seiji Sam Lee escribió:
>>
>> Right! great argument, but ....
>>
>> I have done a buffer with a hidden realloc, it born with size zero and
>> realloc when it is needed. There aren't a exlicit realloc method. Would be
>> util for the community?
>>
>>
>> El viernes, 31 de agosto de 2012 19:23:16 UTC+2, codepilot Account
>> escribió:
>>>
>>> Buffers can in a way be resized, use slice to make smaller, and concat to
>>> make bigger. I doubt slice frees anything, but concat does allocate if it
>>> needs to.
>>>
>>> On Thu, Aug 30, 2012 at 2:48 PM, Ben Noordhuis <[email protected]>
>>> wrote:
>>>>
>>>> On Thu, Aug 30, 2012 at 11:12 PM, Seiji Sam Lee <[email protected]>
>>>> wrote:
>>>> > Apologize if this is a old-issue but, why Buffer has its size static?
>>>> >
>>>> > Why don't use realloc to resize its capacity?
>>>>
>>>> Because bad things would happen if the code below was legal:
>>>>
>>>>   var buf = new Buffer(1024);
>>>>   fs.read(fd, buf, buf.length, cb);
>>>>   buf.resize(32);
>>>>
>>>> --
>>>> Job Board: http://jobs.nodejs.org/
>>>> Posting guidelines:
>>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nodejs" group.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to