mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-07 22:50:53 +03:00
add fxA ui elements
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user