node-struct icon indicating copy to clipboard operation
node-struct copied to clipboard

How do I use the same template to read different buffers?

Open r03ert0 opened this issue 9 years ago • 1 comments

I am using struct to write the header of binary files. If the struct template is Header, is it ok to do:

Header.allocate(); var data1=Header.buffer();

fill data1 with my settings, and then do again

Header.allocate(); var data2=Header.buffer();

to create file number 2?

r03ert0 avatar Aug 20 '16 17:08 r03ert0

There is no sense to call allocate twice on same instance. Reuse old buffer, create new instance, or use _setBuffer method

xdenser avatar Aug 21 '16 09:08 xdenser