add fxA ui elements
This commit is contained in:
parent
4c64593262
commit
894545a6f0
29 changed files with 612 additions and 370 deletions
|
@ -1,3 +1,4 @@
|
|||
/* global MAXFILESIZE */
|
||||
import { blobStream, concatStream } from './streams';
|
||||
|
||||
export default class Archive {
|
||||
|
@ -34,4 +35,21 @@ export default class Archive {
|
|||
get stream() {
|
||||
return concatStream(this.files.map(file => blobStream(file)));
|
||||
}
|
||||
|
||||
addFiles(files) {
|
||||
const newSize = files.reduce((total, file) => total + file.size, 0);
|
||||
if (this.size + newSize > MAXFILESIZE) {
|
||||
return false;
|
||||
}
|
||||
this.files = this.files.concat(files);
|
||||
return true;
|
||||
}
|
||||
|
||||
checkSize() {
|
||||
return this.size <= MAXFILESIZE;
|
||||
}
|
||||
|
||||
remove(index) {
|
||||
this.files.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue