封装的一个文件流下载工具
```js
export const downloadFromFileStream = (fileStream, fileName, type) => {
const blob = new Blob([fileStream], {type})
const objectUrl = URL.createObjectURL(blob)
const link = document.createElement("a")
link.href = objectUrl
link.setAttribute("download", fileName)
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
export const fileNameFactory = (name, option = {prepend: true, append: true}) => {
const date = new Date()
const year = date.getFullYear().toString()
const month = (date.getMonth() + 1).toString().length === 1 ? '0' + (date.getMonth() + 1).toString() : (date.getMonth() + 1).toString()
const day = date.getDate().toString().length === 1 ? '0' + date.getDate().toString() : date.getDate().toString()
const hour = date.getHours().toString().length === 1 ? '0' + date.getHours().toString() : date.getHours().toString()
const minutes = date.getMinutes().toString().length === 1 ? '0' + date.getMinutes().toString() : date.getMinutes().toString()
const {prepend, append} = option
if (prepend) name = `${year}${month}${day}` + name
if (append) name += `${hour}点${minutes}分`
return name
}