Optional
oneOptional
pluginsPlugins you want to install on the BufferWrapper intance you are about to create
// Plugin we are creating
const BufWrapperPlugin = {
writeCustomType(data) {
// You can access the BufWrapper
// instance with the `this` keyword
},
readCustomType() {
// Do stuff
return someValue;
}
}
// Setting the first argument as null
// since we don't have any data yet
const buf = new BufWrapper(null, {
plugins: { BufWrapperPlugin }
});
// Call the plugin's method
buf.plugins.BufWrapperPlugin.writeCustomType(yourData);
buf.plugins.BufWrapperPlugin.readCustomType();
Generated using TypeDoc
Whether or not to run the
Buffer#concat
method when writing. When set totrue
, you will have to call theBufWrapper#finish
method to get the final buffer. (Making this true and calling) theBufWrapper#finish
will increase performance. When set tofalse
, theBufWrapper#finish
method will throw an error and theBuffer#concat
will be run every time you write something to the buffer.