getResultFromCompletedTask
Method to get the result of a completed task.
Usage
const completedTaskResult = await dataProtectorCore.getResultFromCompletedTask({
taskId: '0x7ac398...',
});
Parameters
import { type GetResultFromCompletedTaskParams } from '@iexec/dataprotector';
taskId
Type: Address
Address of the task ID data you'd like to get the result from.
const completedTaskResult = await dataProtectorCore.getResultFromCompletedTask({
taskId: '0x7ac398...',
});
path
Type: string
Under the hood, a protected data is a zip file. With this path
parameter, you can specify the file you're interested in. The zip file will be uncompressed for you, and only the desired file will be given as the result
.
const completedTaskResult = await dataProtectorCore.getResultFromCompletedTask({
taskId: '0x7ac398...',
path: 'content',
});
pemPrivateKey
Type: string
If you have previously saved or generated a RSA keypair, you can reuse it in further calls.
It needs to be the private key corresponding to the public key initially used to encrypt the protected data.
const completedTaskResult = await dataProtectorCore.getResultFromCompletedTask({
taskId: '0x7ac398...',
pemPrivateKey: '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----',
});
onStatusUpdate
Type: OnStatusUpdateFn<ConsumeProtectedDataStatuses>
Callback function to be notified at intermediate steps.
const completedTaskResult =
await dataProtectorCore.getResultFromCompletedTask({
taskId: '0x7ac398...',
onStatusUpdate: ({ title, isDone }) => {
console.log(title, isDone);
},
});
You can expect this callback function to be called with the following titles:
'CONSUME_RESULT_DOWNLOAD';
'CONSUME_RESULT_DECRYPT';
Once with isDone: false
, and then with isDone: true
Return Value
import { type GetResultFromCompletedTaskResponse } from '@iexec/dataprotector';
result
ArrayBuffer
The actual content of the protected file.
<script setup>
import RequiredBadge from '@/components/RequiredBadge.vue'
import OptionalBadge from '@/components/OptionalBadge.vue'
</script>