upload.test.js 965 B

1234567891011121314151617181920212223242526272829
  1. const async = require('async');
  2. const fs = require('fs')
  3. const path = require('path')
  4. const ImageUtils = require('../src/service/ImageUtils')
  5. async function readDir(dir, orderId, subOrderId, relative) {
  6. await async.forEachOf(fs.readdirSync(dir), async child => {
  7. if (!child.startsWith('.')) {
  8. let currRelative = relative ? child : (relative + '/' + child)
  9. console.log(currRelative);
  10. let info = fs.statSync(path.resolve(dir, child));
  11. if (info.isDirectory()) {
  12. await readDir(path.resolve(dir, child), orderId, subOrderId, currRelative)
  13. } else {
  14. }
  15. }
  16. })
  17. }
  18. readDir('/Users/drew/Downloads/桌面客户端上传测试', 111, 222, '')
  19. async function t() {
  20. for (let i = 0; i < 10; i++) {
  21. let src = await ImageUtils.makeThumbnail('/Users/drew/Downloads/桌面客户端上传测试/456789096543/1G4A2391.CR2');
  22. console.log(src);
  23. }
  24. }
  25. t()