compress from buffer