A stricken waste firm put in jeopardy after a devastating blaze has been bought out to save its staff and customers.