摘要: 老陈打码 json 开始看第10课 json { "name": "laochen", "version": "1.0.0", "description": "", "main": "index.js", "dependencies": { "axios": "^0.21.1", "jquery": 阅读全文
posted @ 2021-06-14 22:42 13522679763-任国强 阅读(69) 评论(0) 推荐(0)
摘要: let fs = require('fs'); // 创建读取流 fs.createReadStream(路径【配置项】) // let rs = fs.createReadStream('hello.txt',{flag:"r",encoding:"utf-8"}); let rs = fs.cr 阅读全文
posted @ 2021-06-14 19:30 13522679763-任国强 阅读(177) 评论(0) 推荐(0)
摘要: let fs = require('fs'); // 1 创建写入流 // fs.createWriteStream(文件路径,[可选择的配置操作]) // 2 let ws = fs.createWriteStream("hello.txt",{flag:'w',encoding:"utf8"}) 阅读全文
posted @ 2021-06-14 18:28 13522679763-任国强 阅读(120) 评论(0) 推荐(0)
摘要: let fs = require('fs') // 封装 异步读取文件 function fsRead(path){ return new Promise(function(resolve,reject){ fs.readFile(path,{flag:"r",encoding:"utf-8"},f 阅读全文
posted @ 2021-06-14 17:22 13522679763-任国强 阅读(718) 评论(0) 推荐(0)
摘要: let fs = require('fs') // 异步 写入文件 // write w 写入 // read r 读取 // append a 追加 // fs.writeFile('test.txt',"鱼香茄子\n",{flag:"a",encoding:"utf-8"},function(e 阅读全文
posted @ 2021-06-14 17:02 13522679763-任国强 阅读(506) 评论(0) 推荐(0)
摘要: var fs = require('fs'); // 同步 读取文件内容 // var conent = fs.readFileSync('hello.txt',{flag:'r',encoding:'utf-8'}) // console.log(123); // console.log(cone 阅读全文
posted @ 2021-06-14 17:00 13522679763-任国强 阅读(385) 评论(0) 推荐(0)