We present a new class of single-photon devices for counting of both visible and infrared photons. Our superconducting single-photon detectors (SSPDs) are characterized by the intrinsic quantum efficiency (QE) reaching up to 100%, above 10 GHz counting rate, and negligible dark counts. The detection mechanism is based on the photon-induced hotspot formation and subsequent appearance of a transient resistive barrier across an ultrathin and submicron-wide superconducting stripe. The devices are fabricated from 3.5-nm-thick NbN films and operate at 4.2 K, well below the NbN superconducting transition temperature. Various continuous and pulsed laser sources in the wavelength range from 0.4 μm up to >3 μm were implemented in our experiments, enabling us to determine the detector QE in the photon-counting mode, response time, and jitter. For our best 3.5-nm-thick, 10×10 μm2-area devices, QE was found to reach almost 100% for any wavelength shorter than about 800 nm. For longer-wavelength (infrared) radiation, QE decreased exponentially with the photon wavelength increase. Time-resolved measurements of our SSPDs showed that the system-limited detector response pulse width was below 150 ps. The system jitter was measured to be 35 ps. In terms of the counting rate, jitter, and dark counts, the NbN SSPDs significantly outperform their semiconductor counterparts. Already identifeid and implemented applications of our devices range from noninvasive testing of semiconductor VLSI circuits to free-space quantum communications and quantum cryptography.