fileSize method

Future<void> fileSize(
  1. String filePath
)

Implementation

Future<void> fileSize(String filePath) async {
  String fullPath = _getFullPath(filePath);
  if (!_isPathAllowed(fullPath)) {
    sendResponse('550 Access denied');
    return;
  }

  File file = File(fullPath);
  if (await file.exists()) {
    int size = await file.length();
    sendResponse('213 $size');
  } else {
    sendResponse('550 File not found');
  }
}