Accept Buffer object instead of filepath