Once I had to do some overnight work at my dad's clinic (tedious task of hiding wires under desks, ergonomic stuff).
I ate a big greasy meal (A&W) and got two extra large coffees triple triple. I lasted until about 4:30 in the morning, then crashed hard

the minute I got home, I didn't even make it to my room - I went to the couch right in the basement where I came in, and slept there until about midday (luckily this was on a weekend).
If you literally mean an all nighter, then I'd suggest lots of sleep the night before. You usually hit a point where you'll feel tired, but if you persist through it it'll pass.