mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
26 lines
793 B
Dart
26 lines
793 B
Dart
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// @dart = 2.9
|
|
|
|
import 'dart:convert';
|
|
import 'dart:io';
|
|
|
|
/// decodes a base64 screenshot stored in the devicelab.
|
|
///
|
|
/// Usage dart tool/screenshot_decoder.dart path/to/log_file
|
|
void main(List<String> arguments) {
|
|
int screenshot = 0;
|
|
final String logFile = arguments.first;
|
|
for (final String line in File(logFile).readAsLinesSync()) {
|
|
if (!line.contains('BASE64 SCREENSHOT:')) {
|
|
continue;
|
|
}
|
|
final String message = line.split('BASE64 SCREENSHOT:')[1];
|
|
final List<int> bytes = base64.decode(message);
|
|
File('flutter_screenshot_$screenshot.png').writeAsBytesSync(bytes);
|
|
screenshot += 1;
|
|
}
|
|
}
|