npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-zipper

v1.0.1

Published

Concise documentation on learning zip file specs found [here](https://medium.com/@felixstridsberg/the-zip-file-format-6c8a160d1c34)

Downloads

40

Readme

Zipper JS

Concise documentation on learning zip file specs found here

Using this library

This library was created to be a quick, efficient solution to adding files into a zip archive. It is a very primative implementation and should be thouroughly tested before using in a production environment.

As of version 0.1.1, asynchronous calls are not supported. Adding files into an archive will block the node event cycle while running.

To use this library:

import { FileZip } from "node-zipper"; // import syntax
const { FileZip } = require("node-zipper"); // commonJS syntax

const zipper = new FileZip();

// first argument is location to save to inside zip folder, second argument is path to file (must be local path to file)
zipper.zip("path/in/zip/file.txt", "/path/to/file.txt");
// ... repeat

zipper.save("/path/to/save/example.zip");

Current Limitations

  • The path to fetch a file must be a local file system path. Currently, Buffers and other data types are not supported
  • Explicit file names are required when zipping and saving content

Contributing

To start a development environment, follow the steps below.

Download python (if needed)

Python 3.x.x is required for this project

Compile package

npm install

This will install all needed dependencies along with building the module. Once built, javascript demo can be written to import library from "lib/binding/Release"

Subsequent compilations after code changes can be compiled with

npm build

This will recompile c++ source code to Javascript to be tested again.

Alternatively, by creating a CMakeLists.txt file with ZipStream, HashTable, and CRC32, a fully functional c++ project can be created for testing independent of the Javascript ecosystem and FileZip class declarations. This allows for fast development focusing on C++ code.

Repository Structure

  • lib: contains all binaries to be disributed with npm
  • demo: simple javascript demo of how to use package and to ensure it is working correctly
  • test: mocha tests to ensure functionality
  • src: c++ source code
    • In this folder, FileZip.h/cpp and index.cpp are the only file interacting with the nodeV8 engine. This was designed intentionally in order to write standard C++ logic that is modular to the node file systenm
    • By copying out CRC32, ZipStream, and HashTable, a fully functional zip library can be reused for C/C++ development