Add toAsyncBuffer code