up
This commit is contained in:
parent
c2c36c7e8a
commit
c846148b21
1 changed files with 14 additions and 13 deletions
|
|
@ -318,10 +318,21 @@ class TlvFilesStorageProcessor {
|
||||||
|
|
||||||
private async handleZipStorages(operation: ZipStoragesOperation) {
|
private async handleZipStorages(operation: ZipStoragesOperation) {
|
||||||
const paths = []
|
const paths = []
|
||||||
const cwd = process.cwd()
|
//const cwd = process.cwd()
|
||||||
|
const name = crypto.randomBytes(16).toString('hex') + '.zip'
|
||||||
for (const storageName in this.storages) {
|
for (const storageName in this.storages) {
|
||||||
this.storages[storageName].PersistNow()
|
this.storages[storageName].PersistNow()
|
||||||
paths.push(cwd + '/' + this.storages[storageName].GetStoragePath())
|
//paths.push(cwd + '/' + this.storages[storageName].GetStoragePath())
|
||||||
|
const path = this.storages[storageName].GetStoragePath()
|
||||||
|
const err = await zip(path, name)
|
||||||
|
if (err) {
|
||||||
|
this.sendResponse({
|
||||||
|
success: false,
|
||||||
|
error: err.message,
|
||||||
|
opId: operation.opId
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (paths.length === 0) {
|
if (paths.length === 0) {
|
||||||
|
|
@ -332,17 +343,7 @@ class TlvFilesStorageProcessor {
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const name = crypto.randomBytes(16).toString('hex') + '.zip'
|
|
||||||
const path = paths.join(', ')
|
|
||||||
const err = await zip(path, name)
|
|
||||||
if (err) {
|
|
||||||
this.sendResponse({
|
|
||||||
success: false,
|
|
||||||
error: err.message,
|
|
||||||
opId: operation.opId
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.sendResponse<string>({
|
this.sendResponse<string>({
|
||||||
success: true,
|
success: true,
|
||||||
type: 'zipStorages',
|
type: 'zipStorages',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue