当前位置:网站首页>Nodejs (four) character reading
Nodejs (four) character reading
2022-04-23 07:47:00 【youth who behaves like an adult】
console.log("ssss");
var fs=require("fs");
var re=fs.createReadStream("Test.txt",{highWaterMark:7});
re.setEncoding('utf8');
var texts="";
re.on("data",function(chunk){
texts+=chunk;
});
re.on("end",function(){
console.log(texts);
});
console.log("5555");
1. The compilation method is different when reading data , There will be garbled code ,re.setEncoding('utf8'); Specifying the encoding method can avoid problems
var fs=require("fs");
var re=fs.createReadStream("Test.txt",{highWaterMark:7});
var xxx=[];
var size=0;
re.on("data",function(chunk){
xxx.push(chunk);
size += chunk.length;
});
re.on("end",function(){
var text=Buffer.concat(xxx,size);
console.log(text.toString());
});
console.log("5555");
2. When reading data, you can cache it first , The final splicing
版权声明
本文为[youth who behaves like an adult]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230626191056.html
边栏推荐
猜你喜欢

Rethink | open the girl heart mode of station B and explore the design and implementation of APP skin changing mechanism

Dropping Pixels for Adversarial Robustness

keytool: command not found

SAP SALV14 后台输出SALV数据可直接保存文件,发送Email(带排序、超链接、筛选格式)

Mongodb 启动警告信息处理

设置了body的最大宽度,但是为什么body的背景颜色还铺满整个页面?

Window10版MySQL设置远程访问权限后不起效果

SAP PI/PO rfc2RESTful 发布rfc接口为RESTful示例(Proxy间接法)

Design optimization of MySQL database

js之预解析
随机推荐
ABAP 从CDS VIEW 发布OData Service示例
typescript字典的使用
Preliminary configuration of OpenGL super Dictionary (freeglut, glew, gltools, GLUT)
12. Constraints
基于NLP的软件安全研究(一)
系统与软件安全研究(一)
踩坑日记:Unable to process Jar entry [module-info.class]
FUEL: Fast UAV Exploration using Incremental Frontier Structure and Hierarchical Planning
2. Restricted query
Page dynamic display time (upgraded version)
int a = 1存放在哪
驼峰命名对像
TimelineWindow
Moment. Format of format method function in JS
ES6使用递归实现深拷贝
C# 多个矩形围成的多边形标注位置的问题
SQL针对字符串型数字进行排序
Mobile game performance optimization
SAP RFC_CVI_EI_INBOUND_MAIN BP主数据创建示例(仅演示客户)
unity 屏幕自适应