make buffer size dynamic, default to 32 * 1024