Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Pizzip is a JavaScript library for creating, reading, and editing zip files in the browser or Node.js. It is particularly useful for handling Office Open XML files, such as .docx, .xlsx, and .pptx, which are essentially zip files containing XML documents.
Create a new zip file
This feature allows you to create a new zip file and add files to it. In this example, a new zip file is created, and a text file named 'hello.txt' with the content 'Hello, World!' is added to it.
const PizZip = require('pizzip');
const zip = new PizZip();
zip.file('hello.txt', 'Hello, World!');
const content = zip.generate({ type: 'nodebuffer' });
Read a zip file
This feature allows you to read an existing zip file. In this example, a zip file named 'example.zip' is read, and the content of the file 'hello.txt' within the zip is extracted as text.
const PizZip = require('pizzip');
const fs = require('fs');
const data = fs.readFileSync('example.zip');
const zip = new PizZip(data);
const fileContent = zip.file('hello.txt').asText();
Modify a file within a zip
This feature allows you to modify the content of a file within an existing zip file. In this example, the content of 'hello.txt' within 'example.zip' is changed to 'Modified content'.
const PizZip = require('pizzip');
const fs = require('fs');
const data = fs.readFileSync('example.zip');
const zip = new PizZip(data);
zip.file('hello.txt', 'Modified content');
const newContent = zip.generate({ type: 'nodebuffer' });
JSZip is a library for creating, reading, and editing zip files in JavaScript. It is similar to Pizzip in functionality, offering a wide range of features for handling zip files. JSZip is widely used and has a large community, making it a robust choice for zip file manipulation.
ADM-ZIP is a pure JavaScript implementation for zip file management with support for reading, creating, and updating zip files. It is similar to Pizzip but is often used in Node.js environments due to its synchronous API, which can be more straightforward for server-side applications.
PizZip is a fork of JSZip version 2.x, because we want a synchronous Zip library.
A library for creating, reading and editing .zip files with Javascript, with a lovely and simple API.
var zip = new PizZip();
zip.file("Hello.txt", "Hello World\n");
var img = zip.folder("images");
img.file("smile.gif", imgData, {base64: true});
var content = zip.generate({type:"blob"});
// see FileSaver.js
saveAs(content, "example.zip");
/*
Results in a zip containing
Hello.txt
images/
smile.gif
*/
PizZip is dual-licensed. You may use it under the MIT license or the GPLv3 license. See LICENSE.markdown.
v3.0.0
Initial release of Pizzip
FAQs
Create, read and edit .zip files synchronously with Javascript
The npm package pizzip receives a total of 0 weekly downloads. As such, pizzip popularity was classified as not popular.
We found that pizzip demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.