write method

  1. @override
Future<void> write(
  1. String absPath,
  2. String content
)
override

Creates or overwrites file absPath with content.

Implementation

@override
Future<void> write(String absPath, String content) async {
  final b64 = base64.encode(utf8.encode(content));
  // Decode base64 on the node to avoid any shell-quoting of the content.
  final r = await _run('printf %s ${_q(b64)} | base64 -d > ${_q(absPath)}');
  if (r.exitCode != 0) {
    throw WorkspaceException('cannot write $absPath: ${r.stderrText.trim()}');
  }
}