pipe: add support for shrinking and growing pipes