3/23/2023 0 Comments Npm archiver![]() ![]() You're welcome to make any feature requests, but remember that this package relies on the above three ThanksĪ big thank you to the above package creators and collaborators for making this possible. Note: Since unzip has been unmaintained for a very long time, it has been forked a number of times this package uses a fork of a fork in order to keep things up to date and maintain a degree of control over its dependencies. There are 4004 other projects in the npm registry using archiver. ![]() Start using archiver in your project by running npm i archiver. Latest version: 5.3.1, last published: 7 months ago. Used by extract() and provided as unzip and tar from the module. a streaming interface for archive generation. Used by archive() and provided to you if you need access to advanced options. Note: Extract doesn't know the format of your archive, so if it's not 'zip', remember to set it. The path to save the archive contents to. The archive path (String), Buffer or Stream. output - (optional) Output type: 'buffer' (default), 'stream', '/path' If you enter a path string, the archive will be saved there and the resolve value will be the path string Įxtraction has finished when the promise resolves - archive.format - (optional) Archive format: 'zip' (default), 'tar'.'/path/name') Optional for 'file' and 'directory' (basenames are used by default), recommended for 'other' (a counter will be used if missing, starts at 0) name - (optional) The name the entry will have in the archive may be a path within the archive (e.g.type - (optional) Entry type: 'file', 'directory', 'other' The type can be automatically determined (but if you know it, use it) Buffer, Stream and String are handled automatically and are classified here as 'other' you can use any name instead of 'other' since it's the default.data - The data you wish to archive: file/directory path (String), Buffer, Stream or String (to save as a file).entriesĪrray of Objects | Array of Strings | Object | String Resolves to an archive Buffer (default), Stream or path depending on the chosen output. catch( console.log) Details archive (entries, options) then(() => console.log( 'Extraction finished!')) ) // the format is 'zip' by default, so you have to specify it for 'tar' You can include Buffers, Streams and Strings in the archive as well ( giving them a name) then( archiveBuffer => console.log( 'Done! We should do something with the buffer.'))Īrchive() //. Npm install simple-archiver -save Usage Archive var archive = require( 'simple-archiver').archive ![]() Once we have appended the files, we will finalize the archive as the last step.Archive multiple files, directories, buffers, streams and strings supports 'zip' and 'tar' formats can output a Buffer (default), Stream or to a path.Ĭan extract archives from a path, Buffer or Stream to a specified path. We will then pipe the archive data to the archiver and append the files we want to add to the zip file. We include another callback for error handling (warnings like stat failures and non-blocking errors might occur as well). When the file stream has closed, we will run a callback that will inform the programmer that the function has written all archive data. In the code below, they are _dirname and example, respectively. Give names to the directory and the compressed zip file. We declare it a zip file using the zlip data compression method. Streams convert massive operations into smaller manageable chunks. We will then create a file to write the stream. Based on project statistics from the GitHub repository for the npm package node-archiver, we found that it has been starred 3 times, and that 22 other projects in the ecosystem are dependent on it. As such, we scored node-archiver popularity level to be Small. The require method uses the source code of the archiver from the node_modules directory. The npm package node-archiver receives a total of 4,476 downloads a week. To use the Node modules, we need to require them at the program’s start. We can zip multiple files using node modules by following the steps given below: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |