Skip to content

Commit

Permalink
Calculate hash tree for file uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Nov 18, 2024
1 parent fb670ba commit 3d615d1
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/views/Drive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2153,13 +2153,16 @@ module.exports = {
}
let reader = new browserio.JSFileReader(file);
let java_reader = new peergos.shared.user.fs.BrowserFileReader(reader);
let fup = new peergos.shared.user.fs.FileWrapper.FileUploadProperties(file.name, {get_0: () => java_reader},
(file.size - (file.size % Math.pow(2, 32))) / Math.pow(2, 32), file.size, java.util.Optional.empty(), java.util.Optional.empty(), false,
overwriteExisting ? true : false, updateProgressBar);
let fileUploadList = uploadParams.fileUploadProperties[foundDirectoryIndex];
fileUploadList.push(fup);
future.complete(true);
peergos.shared.user.fs.HashTree.build(java_reader, (file.size - (file.size % Math.pow(2, 32))) / Math.pow(2, 32),
file.size, this.context.crypto.hasher).thenApply(function(hashtree) {
let fup = new peergos.shared.user.fs.FileWrapper.FileUploadProperties(file.name, {get_0: () => java_reader},
(file.size - (file.size % Math.pow(2, 32))) / Math.pow(2, 32), file.size, java.util.Optional.empty(), java.util.Optional.of(hashtree), false,
overwriteExisting ? true : false, updateProgressBar);
let fileUploadList = uploadParams.fileUploadProperties[foundDirectoryIndex];
fileUploadList.push(fup);
future.complete(true);
}).exceptionally(function(t){future.completeExceptionally(t)})
},
addUploadProgressMessage: function(uploadParams, title, subtitle, directory, finalCall) {
let that = this;
Expand Down

0 comments on commit 3d615d1

Please sign in to comment.