Dart
Dart
Split File into Chunks
Demonstrates how to split a file into chunks.Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
final fac = CkFileAccess();
// Any type of file may be split. It doesn't matter if it's
// a binary file or a text file.
final fileToSplit = 'qa_data/hamlet.xml';
final partPrefix = 'hamlet';
final partExtension = 'part';
final maxChunkSize = 50000;
final destDirPath = 'qa_output';
// Splits hamlet.xml into hamlet1.part, hamlet2.part, ...
// Output files are written to the current working directory.
// Each chunk will be 50000 bytes except for the last which
// will be the remainder.
try {
fac.splitFile(fileToSplit, partPrefix, partExtension, maxChunkSize, destDirPath);
print('Success.');
} on ChilkatException catch (e) {
print(e.lastErrorText);
}
}