当前位置:网站首页>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
边栏推荐
- 对js中argumens的简单理解
- 根据某一指定的表名、列名及列值来向前或向后N条查相关列值的SQL自定义标量值函数
- 'NPM' is not an internal or external command, nor is it a runnable program or batch file
- instanceof的实现原理
- Samplecamerafilter
- 快速排序
- Dropping Pixels for Adversarial Robustness
- SAP pi / PO rfc2restful publishing RFC interface is a restful example (proxy indirect method)
- c#读取INI文件和向ini文件写入数据
- Use of command line parameter passing library argparse
猜你喜欢
js之什么是事件?事件三要素以及操作元素
SAP 03-AMDP CDS Table Function using ‘WITH‘ Clause(Join子查询内容)
MySQL8.0 安装/卸载 教程【Window10版】
Online Safe Trajectory Generation For Quadrotors Using Fast Marching Method and Bernstein Basis Poly
SAP DEBUG调试FOR IN、REDUCE等复杂的语句
Dropping Pixels for Adversarial Robustness
对js中argumens的简单理解
SAP pi / PO rfc2soap publishes RFC interface as WS example
SAP PI/PO rfc2RESTful 發布rfc接口為RESTful示例(Proxy間接法)
Nacos / sentinel gateway current limiting and grouping (code)
随机推荐
unity 屏幕自适应
Scrapy 修改爬虫结束时统计数据中的时间为当前系统时间
Game assisted script development journey
What are the total number of all courses of Mr. Tang Xiaoyang, who is very popular in CSDN (question mark)
MySQL index
js之节点操作,为什么要学习节点操作
二叉树的深度
SAP PI/PO rfc2RESTful 发布rfc接口为RESTful示例(Proxy间接法)
url转成对象
TimelineWindow
面经的总结
异步的学习
6. Aggregation function and grouping statistics
MySQL isolation level
快排的练习
Dropping Pixels for Adversarial Robustness
ABAP 7.4 SQL Window Expression
Hot change scheme and dynamic update strategy of mobile game
Configure NPM
SAP DEBUG调试FOR IN、REDUCE等复杂的语句