nodeJs(2)

nodeJs(2)_第1张图片

export  与 module.export 的区别  

tip:  修改变量 还是  修改对象的属性

/*
原因:  exports = module.exports;
如果对 exports 重新定义  将会修改指向范围  导致逻辑错误
*/

nodeJs(2)_第2张图片

nodeJs(2)_第3张图片

package.json 是必须的文件  

tip: json文件中不能写注释

增强版的模块

 

nodeJs(2)_第4张图片

nodeJs(2)_第5张图片

npm  搜索包过程   不断的搜索上级的node_modules模块

nodeJs(2)_第6张图片

 

Buffer缓冲区:

nodeJs(2)_第7张图片

数组的弊端:1  性能差   2   无法存储二进制编码(音乐,图片)

nodeJs(2)_第8张图片

buf.length  占用内存的大小 单位为字节   1个汉字占用3个字节

str.length   字符串的长度

nodeJs(2)_第9张图片

nodeJs(2)_第10张图片

nodeJs(2)_第11张图片

数字的特殊性

nodeJs(2)_第12张图片

 

node同步文件写入

nodeJs(2)_第13张图片

异步与同步调用

nodeJs(2)_第14张图片

异步调用

nodeJs(2)_第15张图片

 

nodeJs(2)_第16张图片

使用绝对路径的方式写入内容   

nodeJs(2)_第17张图片

 

nodeJs(2)_第18张图片

流式文件读取

nodeJs(2)_第19张图片

nodeJs(2)_第20张图片

nodeJs(2)_第21张图片

 

nodeJs(2)_第22张图片

 

nodeJs(2)_第23张图片

nodeJs(2)_第24张图片

 

nodeJs(2)_第25张图片

文件重命名  可以达到  剪切文件的功能

你可能感兴趣的:(nodeJs(2))