Created
June 16, 2023 17:07
-
-
Save Kitketovsky/e68623ef928ba46c3a7f2d02ba7f85fb to your computer and use it in GitHub Desktop.
From binary to .zip with JSZip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from "fs"; | |
import JSZip from "jszip"; | |
export default async function fromBinaryToZip() { | |
const data = await dbx.filesDownloadZip({ path: "/br1" }); | |
const zip = new JSZip(); | |
await zip.loadAsync(binaryData); | |
const content = await zip.generateAsync({ type: "nodebuffer" }); | |
fs.writeFileSync(filePath, content); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment