Run prettier through everything.
This commit is contained in:
32
utils/zip.ts
32
utils/zip.ts
@@ -2,31 +2,27 @@ import JSZip, { JSZipFileOptions } from 'jszip'
|
||||
import { saveAs } from 'file-saver'
|
||||
|
||||
interface File {
|
||||
name: string
|
||||
content: any
|
||||
options?: JSZipFileOptions
|
||||
name: string
|
||||
content: any
|
||||
options?: JSZipFileOptions
|
||||
}
|
||||
|
||||
interface Zipped {
|
||||
saveFile: (filename: string) => void
|
||||
data: Blob
|
||||
saveFile: (filename: string) => void
|
||||
data: Blob
|
||||
}
|
||||
|
||||
export const createZip = async (files: File[]): Promise<Zipped> => {
|
||||
const zip = new JSZip()
|
||||
const zip = new JSZip()
|
||||
|
||||
files.forEach(({ name, content, options }) => {
|
||||
zip.file(name, content, options)
|
||||
})
|
||||
files.forEach(({ name, content, options }) => {
|
||||
zip.file(name, content, options)
|
||||
})
|
||||
|
||||
const data = await zip.generateAsync({ type: "blob" })
|
||||
const data = await zip.generateAsync({ type: 'blob' })
|
||||
|
||||
return {
|
||||
saveFile: (filename: string) =>
|
||||
saveAs(data, filename),
|
||||
data
|
||||
}
|
||||
return {
|
||||
saveFile: (filename: string) => saveAs(data, filename),
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user