node package manager


zip packing middleware


Shrinkwrap server for cortex

    var app = express();
    // app.use('/mod',express.static('mod')); 
      pack: path.join(__dirname,"zip")
        root: path.join(__dirname,"mod"),
        pack: path.join(__dirname,"zip")
        res.send(404,"not found");

root: module root directory for cortex pack: zip package root directory

    |-- a
        |-- 0.1.0
            |-- a.js
            |-- cortex-shrinkwrap.json
        |-- 0.1.2
            |-- b.js

/zip/a/ full package zip

the zip file will contains self and all it's packages


  • R rename one origin file to another
  • C copy one origin file to another
  • M modified, use patch version to cover origin one
  • A add new file from patch folder
  • D remove from origin folder

/zip/a/0.1.0-checksum: checksum of the final folder

md5( [ md5(relpath1) + md5(filecontent1), md5(relpath2) + md5(filecontent2), ... ].sort().join('') )

/zip/a/0.1.0.min-checksum /zip/a/ /zip/a/ will filter files ends with .min or will filter files that not ends with .min

Content-MD5: <md5 of zip file>
  1. clone this project git clone
  2. copy server.js to some other path to prevent pull conflict cd shrinkwrap-packer && cp server.js _server.js
  3. edit _server.js config pack(folder to store zip file) and root(folder to search static files), feel free to change port
  4. install pm2 npm install pm2 -g
  5. prepare start script echo 'pm2 start _server.js -i max --name "shrinkwrap-packer"' > && chmod +x
  6. prepare restart script echo 'npm install && pm2 restart "shrinkwrap-packer"' > && chmod +x
  7. start server ./
  8. config nginx
    location /zip {