Skip to content

MM56/mm-packer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.