move file management in common.js lib