Use buffer instead of file