js-uploader
Version:
A JavaScript library for file upload
22 lines • 706 B
JavaScript
import { idGenerator } from '../../utils';
import { StatusCode } from '../../interface';
export var taskFactory = function (file, singleFileTask) {
var pos = file.relativePath.indexOf('/');
var name = singleFileTask || pos === -1 ? file.name : file.relativePath.substring(0, pos);
var task = {
id: 'task-' + idGenerator(),
name: name,
type: pos === -1 ? 'file' : 'dir',
fileIDList: [file.id],
fileSize: file.size,
fileList: [file],
uploaded: 0,
extraInfo: {},
oss: null,
progress: 0,
status: StatusCode.Pause,
addTime: new Date(),
};
return task;
};
//# sourceMappingURL=task-factory.js.map