Revert "Revert "Add support for custom buffer sizes.""

This reverts commit 2499eb3764e4d42e9b5117c00e115f6200e7f231.