Interface BufWrapperOptions<Plugins>

Type Parameters

  • Plugins

Hierarchy

  • BufWrapperOptions

Properties

Properties

oneConcat?: boolean

Whether or not to run the Buffer#concat method when writing. When set to true, you will have to call the BufWrapper#finish method to get the final buffer. (Making this true and calling) the BufWrapper#finish will increase performance. When set to false, the BufWrapper#finish method will throw an error and the Buffer#concat will be run every time you write something to the buffer.

plugins?: Plugins

Plugins you want to install on the BufferWrapper intance you are about to create

Exemple

// 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