10

dart转换字符串为二进制流

 3 years ago
source link: https://www.myfreax.com/dartzhuan-huan-zi-fu-chuan-wei-er-jin-zhi-liu/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
更新于 2021/06/29 |  创建于 2021/06/29

dart转换字符串为二进制流

下面的代码将字符串字符串转换为二进制流stream,并管道到grep进程

import 'dart:io';
import 'dart:convert';

main() async {
  var grep = await Process.start('grep', ['hello']);
  Stream.value(const Utf8Codec().encode(server)).pipe(grep.stdin);
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK