http:再看
http.get(url,(res)=>{

let sum = "";
res.setEncoding('utf8')
res.on('data' ,(chunk)=>{
       sum += chunk
} )

res.on('end',()=>{
       console.log(sum)
} )

})
url
url.parse(url)
url.format(obj)
url.resolve(url + 'abc')

querystring
qs.parse(str,[';'],[':'])
qs.stringify(str,[';'],[':'])
qs.escape(str)
qs.unescape(str)

fs
回调错误优先

文件
fs.writeFile
fs.readFile
fs.appendFile
fs.unlink
fs.existSync 是否存在

文件夹
fs.mkdir 创建
fs.rmdir 删除
fs.readdir 读取文件夹内容
fs.stat

10.0以上版本
var s = fs.promises

fs.watch(url,(eventType,filename)=>{
})
fs.watchFile(url,(current,previous)=>{

})

const readStream = fs.createReadStream('url')
const writeStream = fs.createWriteStream('url')
readStream.pipe(writeStream)
zlib
zlib
gzip = zlib.createGzip

events
events.on()
events.once()
events.off()
events.emit ()

path
path.extname()

static
静态资源访问

router

Last modification:July 24th, 2019 at 11:03 pm
同道中人,加个好友