Use Buffer.isBuffer() instead of `instanceof Buffer` so it works in the browser too.