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.