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#concatmethod when writing. When set totrue, you will have to call theBufWrapper#finishmethod to get the final buffer. (Making this true and calling) theBufWrapper#finishwill increase performance. When set tofalse, theBufWrapper#finishmethod will throw an error and theBuffer#concatwill be run every time you write something to the buffer.