The thermodynamic implications of information processing have received renewed attention, in contexts such as quantum information theory, artificial molecular machines, and microscopic feedback control. I will describe a model system that offers a simple paradigm for exploring the interplay between heat, work and information. This "Maxwell demon" interacts with a thermal reservoir, a stream of bits, and a mass that can be lifted or lowered. Its dynamics are modeled with explicit, thermodynamically consistent equations of motion. The exact solution of these equations is used to construct a nonequilibrium phase diagram, which reveals that the demon can act either as an engine, converting heat to work while writing information to the stream of bits, or as an eraser, using the energy of the falling mass to erase information in the bit stream.