make converter support both stream and buffer