Constructor
new AesFileImporter(bufferSize, threads)
Constructs a file importer that can be used to import files to the drive
Parameters:
Name | Type | Default | Description |
---|---|---|---|
bufferSize |
number | 0 | Buffer size to be used when encrypting files. If using integrity this value has to be a multiple of the Chunk size. If not using integrity it should be a multiple of the AES block size for better performance |
threads |
number | 1 | The threads to use |
Classes
Methods
getError(err) → {any}
Tranform an error that can be thrown from a web worker.
Parameters:
Name | Type | Description |
---|---|---|
err |
any | The original error |
Returns:
The transformed error
- Type
- any
(async) getMinimumPartSize(sourceFile, targetFile) → {Promise.<number>}
Get the minimum part of a file that can run under a thread.
Parameters:
Name | Type | Description |
---|---|---|
sourceFile |
IFile | The source file. |
targetFile |
IVirtualFile | The target file |
Returns:
The minimum file part.
- Type
- Promise.<number>
(async) getWorkerMessage(index, sourceFile, targetFile, runningThreads, partSize, fileSize, bufferSize, integrity) → {any}
Create a message for the web worker.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | The worker index |
sourceFile |
IFile | The source file |
targetFile |
IVirtualFile | The target file |
runningThreads |
number | The number of threads scheduled |
partSize |
number | The length of the file part that will be imported |
fileSize |
number | The file size |
bufferSize |
number | The buffer size |
integrity |
boolean | True if integrity is enabled. |
Returns:
The message to be sent to the worker
- Type
- any
(async) onPrepare(targetFile, integrity)
Called during preparation of import.
Parameters:
Name | Type | Description |
---|---|---|
targetFile |
IVirtualFile | The target file |
integrity |
boolean | True if integrity enabled |