nodejs write csv chinese
import fs from 'fs'
import json2csv from 'json2csv'
import { Iconv } from 'iconv'
const data = [{name: '刘亦菲', sex: '女', name: '刘德华', sex: '男'}]
const fields = ['name', 'sex']
const csv = json2csv({ data, fields })
const newFile = fs.createWriteStream('file.csv')
const buffer = iconv.convert(csv)
newFile.write(buffer)