楊村長(zhǎng)JS練功房
fs.writeFile() 寫(xiě)入文件或創(chuàng)建文件
fs.writeFile(fileName,data[,options],callback)
參數(shù)path:要寫(xiě)入內(nèi)容或要?jiǎng)?chuàng)建的文件路徑
參數(shù)data:表示要寫(xiě)入的內(nèi)容
參數(shù)option:表示以什么格式寫(xiě)入文件內(nèi)容,默認(rèn)值是utf8
參數(shù)callback:文件寫(xiě)入內(nèi)容之后執(zhí)行的回調(diào)函數(shù)
注意點(diǎn):
重復(fù)使用writeFile會(huì)覆蓋文件內(nèi)容
標(biāo)簽: