BUCServer.js 917 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. const fs = require('fs-extra');
  2. const FileDownloader = require('../FileDownloader');
  3. const log = new (require('../AppLogger'))().log;//singleton
  4. let instance = null;
  5. //singleton
  6. class BUCServer {
  7. constructor(config) {
  8. if (!instance) {
  9. this.config = Object.assign({}, config);
  10. this.config.tempDownloadDir = `${config.tempDir}/download`;
  11. fs.ensureDirSync(this.config.tempDownloadDir);
  12. this.down = new FileDownloader(config.maxUploadFileSize);
  13. instance = this;
  14. }
  15. return instance;
  16. }
  17. async main() {
  18. try {
  19. //
  20. log(`---------------------------`);
  21. log(`Book Update checker started`);
  22. log(`---------------------------`);
  23. } catch (e) {
  24. log(LM_FATAL, e.stack);
  25. }
  26. }
  27. }
  28. module.exports = BUCServer;