Preparation and application of chitosan nanoparticles and nanofibers