Update src/tools/move-drive-files.ts
This commit is contained in:
parent
6b2888383c
commit
389f420cad
1 changed files with 5 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
import * as Minio from 'minio';
|
import * as Minio from 'minio';
|
||||||
import * as uuid from 'uuid';
|
import * as uuid from 'uuid';
|
||||||
|
const sequential = require('promise-sequential');
|
||||||
import DriveFile, { DriveFileChunk, getDriveFileBucket } from '../models/drive-file';
|
import DriveFile, { DriveFileChunk, getDriveFileBucket } from '../models/drive-file';
|
||||||
import DriveFileThumbnail, { DriveFileThumbnailChunk } from '../models/drive-file-thumbnail';
|
import DriveFileThumbnail, { DriveFileThumbnailChunk } from '../models/drive-file-thumbnail';
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
|
@ -11,7 +12,7 @@ DriveFile.find({
|
||||||
withoutChunks: false
|
withoutChunks: false
|
||||||
}]
|
}]
|
||||||
}).then(async files => {
|
}).then(async files => {
|
||||||
files.forEach(async file => {
|
await sequential(files.map(file => async () => {
|
||||||
const minio = new Minio.Client(config.drive.config);
|
const minio = new Minio.Client(config.drive.config);
|
||||||
|
|
||||||
const keyDir = `${config.drive.prefix}/${uuid.v4()}`;
|
const keyDir = `${config.drive.prefix}/${uuid.v4()}`;
|
||||||
|
@ -60,5 +61,7 @@ DriveFile.find({
|
||||||
await DriveFileThumbnail.remove({ _id: thumbnail._id });
|
await DriveFileThumbnail.remove({ _id: thumbnail._id });
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
});
|
|
||||||
|
console.log('done', file._id);
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue