Skip to content

getResultFromCompletedTask

Method to get the result of a completed task.

Usage

ts
const 
completedTaskResult
=
await
dataProtectorSharing
.
getResultFromCompletedTask
({
taskId
: '0x7ac398...',
});

Parameters

ts
import { type 
GetResultFromCompletedTaskParams
} from '@iexec/dataprotector';

taskId Required *

Type: Address

Address of the task ID data you'd like to get the result from.

ts
const 
completedTaskResult
=
await
dataProtectorSharing
.
getResultFromCompletedTask
({
taskId
: '0x7ac398...',
});

path Optional

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.

ts
const 
completedTaskResult
=
await
dataProtectorSharing
.
getResultFromCompletedTask
({
taskId
: '0x7ac398...',
path
: 'content',
});

pemPrivateKey Optional

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.

ts
const 
completedTaskResult
=
await
dataProtectorSharing
.
getResultFromCompletedTask
({
taskId
: '0x7ac398...',
pemPrivateKey
:
'-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----', });

onStatusUpdate Optional

Type: OnStatusUpdateFn<ConsumeProtectedDataStatuses>

Callback function to be notified at intermediate steps.

ts
const 
completedTaskResult
=
await
dataProtectorSharing
.
getResultFromCompletedTask
({
taskId
: '0x7ac398...',
onStatusUpdate
: ({
title
,
isDone
}) => {
console
.
log
(
title
,
isDone
);
}, });

You can expect this callback function to be called with the following titles:

ts
'CONSUME_RESULT_DOWNLOAD';
'CONSUME_RESULT_DECRYPT';

Once with isDone: false, and then with isDone: true

Return value

ts
import { type 
GetResultFromCompletedTaskResponse
} from '@iexec/dataprotector';

result

ArrayBuffer

The actual content of the protected file.