ADM-\/\+ZIP is a pure Java\+Script implementation for zip data compression for \href{https://nodejs.org/}{\texttt{ Node\+JS}}.\hypertarget{md_sfcode_node_modules_adm_zip_README_autotoc_md2532}{}\doxysection{Installation}\label{md_sfcode_node_modules_adm_zip_README_autotoc_md2532}
With \href{https://www.npmjs.com/}{\texttt{ npm}} do\+: \begin{DoxyVerb}$ npm install adm-zip
\end{DoxyVerb}
 \hypertarget{md_sfcode_node_modules_adm_zip_README_autotoc_md2533}{}\doxysubsection{What is it good for?}\label{md_sfcode_node_modules_adm_zip_README_autotoc_md2533}
The library allows you to\+:


\begin{DoxyItemize}
\item decompress zip files directly to disk or in memory buffers
\item compress files and store them to disk in .zip format or in compressed buffers
\item update content of/add new/delete files from an existing .zip
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_adm_zip_README_autotoc_md2534}{}\doxysection{Dependencies}\label{md_sfcode_node_modules_adm_zip_README_autotoc_md2534}
There are no other node\+JS libraries that ADM-\/\+ZIP is dependent of\hypertarget{md_sfcode_node_modules_adm_zip_README_autotoc_md2535}{}\doxysection{Examples}\label{md_sfcode_node_modules_adm_zip_README_autotoc_md2535}
\hypertarget{md_sfcode_node_modules_adm_zip_README_autotoc_md2536}{}\doxysubsection{Basic usage}\label{md_sfcode_node_modules_adm_zip_README_autotoc_md2536}

\begin{DoxyCode}{0}
\DoxyCodeLine{var AdmZip = require('adm-\/zip');}
\DoxyCodeLine{}
\DoxyCodeLine{// reading archives}
\DoxyCodeLine{var zip = new AdmZip("{}./my\_file.zip"{});}
\DoxyCodeLine{var zipEntries = zip.getEntries(); // an array of ZipEntry records}
\DoxyCodeLine{}
\DoxyCodeLine{zipEntries.forEach(function(zipEntry) \{}
\DoxyCodeLine{    console.log(zipEntry.toString()); // outputs zip entries information}
\DoxyCodeLine{    if (zipEntry.entryName == "{}my\_file.txt"{}) \{}
\DoxyCodeLine{         console.log(zipEntry.getData().toString('utf8')); }
\DoxyCodeLine{    \}}
\DoxyCodeLine{\});}
\DoxyCodeLine{// outputs the content of some\_folder/my\_file.txt}
\DoxyCodeLine{console.log(zip.readAsText("{}some\_folder/my\_file.txt"{})); }
\DoxyCodeLine{// extracts the specified file to the specified location}
\DoxyCodeLine{zip.extractEntryTo(/*entry name*/"{}some\_folder/my\_file.txt"{}, /*target path*/"{}/home/me/tempfolder"{}, /*maintainEntryPath*/false, /*overwrite*/true);}
\DoxyCodeLine{// extracts everything}
\DoxyCodeLine{zip.extractAllTo(/*target path*/"{}/home/me/zipcontent/"{}, /*overwrite*/true);}
\DoxyCodeLine{}
\DoxyCodeLine{}
\DoxyCodeLine{// creating archives}
\DoxyCodeLine{var zip = new AdmZip();}
\DoxyCodeLine{}
\DoxyCodeLine{// add file directly}
\DoxyCodeLine{var content = "{}inner content of the file"{};}
\DoxyCodeLine{zip.addFile("{}test.txt"{}, Buffer.alloc(content.length, content), "{}entry comment goes here"{});}
\DoxyCodeLine{// add local file}
\DoxyCodeLine{zip.addLocalFile("{}/home/me/some\_picture.png"{});}
\DoxyCodeLine{// get everything as a buffer}
\DoxyCodeLine{var willSendthis = zip.toBuffer();}
\DoxyCodeLine{// or write everything to disk}
\DoxyCodeLine{zip.writeZip(/*target file name*/"{}/home/me/files.zip"{});}
\DoxyCodeLine{}
\DoxyCodeLine{}
\DoxyCodeLine{// ... more examples in the wiki }

\end{DoxyCode}


For more detailed information please check out the \href{https://github.com/cthackers/adm-zip/wiki}{\texttt{ wiki}}.

\href{https://travis-ci.org/cthackers/adm-zip}{\texttt{ }} 