encryptFile method
Future<void>
encryptFile(
- String inputPath,
- String outputPath, {
- required List<
EncryptionPublicKey> recipients, - Map<
String, String> context = const {}, - int chunkSize = defaultStreamChunkSize,
- ProgressCallback? onProgress,
- CancellationToken? cancel,
Encrypts inputPath into outputPath with bounded memory.
Output is written to a temporary file in the destination directory and
renamed into place on success; on failure or cancellation the temporary
file is deleted and outputPath is left untouched.
Implementation
Future<void> encryptFile(
String inputPath,
String outputPath, {
required List<EncryptionPublicKey> recipients,
Map<String, String> context = const {},
int chunkSize = defaultStreamChunkSize,
ProgressCallback? onProgress,
CancellationToken? cancel,
}) => _writeAtomically(
outputPath,
encryptStream(
File(inputPath).openRead(),
recipients: recipients,
context: context,
chunkSize: chunkSize,
onProgress: onProgress,
cancel: cancel,
),
);