Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1.11 KB

File metadata and controls

34 lines (25 loc) · 1.11 KB

🐢 Node.js

🌟 The different core modules

Zlib

The zlib module provides compression functionality implemented using Gzip, Deflate/Inflate, and Brotli. You will have to use it most often if you are dealing with archives on your system.

for await (const [file, fileLocation] of getFilesRecursive(tempLocation)) {
    const rel = dirname(relative(tempLocation, fileLocation));
    if (rel !== "." && !memcache.has(rel)) {
        await mkdir(join(destination, rel), { recursive: true });
        memcache.add(rel);
    }

    const pendingPromise = pipestreams(
        createReadStream(fileLocation),
        zlib.createBrotliDecompress(), // <--
        createWriteStream(join(destination, rel, file));
    );
    streamPromises.push(pendingPromise);
}

If you have to manage archives in .tar or .zip I recommend the following packages:


⬅️ 🌟 The different core modules: Assert | ➡️ 🌟 The different core modules: Readline