We fabricate titanium disulfide (TiS2) using a liquid exfoliation method and subsequently a TiS2-based device by optically depositing the TiS2 material onto the microfiber. This device exhibits a strong nonlinear saturable absorption property with an optical modulation depth of 8.3% at 1560 nm. With the implementation of this all-fiber TiS2-based saturable absorber, we demonstrate that both mode-locking and Q-switching operation can be obtained in a turn-key all-fiber erbium-doped laser cavity.