mm-packer

4.0.5 • Public • Published

MM Packer

NPM

Goal

Minimize HTTP requests.

How it works

Inspired by Magipack.js, it concatenates any kind of files into a "pack" file coming with JSON file that specifies what files are packed, where they are in the pack bitwise and what type they are.

Requirements

  • node.js

Dependencies

Installation

npm install mm-packer

Usage

CLI

$ mm-packer -s files/original -o files/packed

Options

  -s, --source FILE      Source directory
  -o, --output FILE      Output directory
  -n, --name [STRING]    Pack files name (Default is pack)
  -k, --no-color         Omit color from output
      --debug            Show debug information
  -v, --version          Display the current version
  -h, --help             Display help and usage details

API

const packer = require("mm-packer");
const packerOptions = {
    source: "files/original",
    output: "files/packed",
    name: "pack" // Optional,
    debug: true // Optional
};
packer(packerOptions);

Example

If you've just downloaded the repository, run :

$ ./bin/mm-packer.js -s files/original -o files/packed

You should see the generated files in files/packed.

You can check the pack can be correctly loaded and parsed with the demo in the folder unpacker that uses mm-unpacker.

/mm-packer/

    Package Sidebar

    Install

    npm i mm-packer

    Weekly Downloads

    24

    Version

    4.0.5

    License

    none

    Last publish

    Collaborators

    • gpolguere
    • pat_hg