Zipping Files
Learn how to zip files together with Node.
We'll cover the following...
Installing dependencies
Up until now, you have been making use of Node’s standard API library, such as the process, path, and os modules. If you want to extend your choice to use more libraries that provide further functionality, you can turn to npm. The npm ecosystem is huge and if you search for a library with certain functionality, chances are that you will find it.
Suppose a member of your team has requested that you zip up a text file and an image. To accomplish this, you will use an external dependency identified as: archiver.
Note: As you might recall from the previous lessons, for installing a dependency, you would normally need to run the
npm install archiverin the terminal. This command will install the dependency intonode_modulesand add it to the project’s dependencies in itspackage.jsonfile. However, you will not have to do this right now, as these dependencies have already been listed in the current project’spackage.jsonfile.
As a reminder,npm installlooks at your project’spackage.jsonfile and installs all of the ...