Now if you want to download the iOS 4 manually without using iTunes, following are the offline download links for iPhone 3G, 3GS, iPhone 4 and iPod 2G, 3G.
In order to install the new iOS 4, make sure you have installed the iTunes 9.2 on your computer. You can download this latest version from Apple site.
Download iOS 4 IPSW files:-iPhone 3G IPSW here
iPhone 3GS IPSW here
iPhone 4 IPSW here
iPod 3G IPSW here
iPod 2G IPSW here
You can backup these jpsw files offline for future use.
You will need to manually update iPhone/iPod Touch to iOS 4.0 if you download iOS 4.0 using above links. Here is guide to manually update/upgrade your iPhone to iOS 4.0.