当前位置:网站首页>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
边栏推荐
- 系统与软件安全研究(三)
- Mongodb 启动警告信息处理
- SAP PI / Po rfc2restful Publishing RFC interface as restful examples (proxy indirect)
- C#操作注册表全攻略
- SAP RFC_CVI_EI_INBOUND_MAIN BP主数据创建示例(仅演示客户)
- The difference and application of VR, AR and MR, as well as some implementation principles of AR technology
- Simple random roll call lottery (written under JS)
- SAP pi / PO rfc2restful publishing RFC interface is a restful example (proxy indirect method)
- 6. Aggregation function and grouping statistics
- Game assisted script development journey
猜你喜欢

SAP PI/PO功能运行状态监控检查

FUEL: Fast UAV Exploration using Incremental Frontier Structure and Hierarchical Planning

SAP CR传输请求顺序、依赖检查

对复杂字典Dictionary<T1,T2>排序问题

SAP RFC_CVI_EI_INBOUND_MAIN BP主数据创建示例(仅演示客户)

int a = 1存放在哪

Date object (JS built-in object)

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

canvas学习第一篇

Configure NPM
随机推荐
Learn to use search engines
对js中argumens的简单理解
Samplecamerafilter
js之自定义属性以及H5中如何判断自定义属性
利用Lambda表达式解决c#文件名排序问题(是100大还是11大的问题)
NodeJS(一) 事件驱动编程
Dropping Pixels for Adversarial Robustness
5. Sql99 standard: internal connection and external connection
Processing of common dependency module
C# 文本文件的查找及替换(WinForm)
promise all的实现
MySQL storage engine
Judge whether the beginning and end of the string contain target parameters: startswith() and endswith() methods
js之DOM学习三种创建元素的方式
js之预解析
canvas学习第一篇
Hot change scheme and dynamic update strategy of mobile game
11. Table and library management
3. Sort statement
Mvcc (multi version concurrency control)