title: NPM Pack: Rename package directory
body: <p>I have a small script that uses <code>npm pack</code> to package a certain nodejs module. When I unpack the <code>.tgz</code> created by the <code>npm pack</code> command the directory inside is named <code>package</code>. My question is if there's a way to rename this package to the acutal name of the project?</p>
  
  <p>Package.json</p>
  
  <pre><code>{
     "name": "package_name",
     "version": "0.0.3",
     "description": "A description",
     "main": "server.js",
     "scripts": {
        "test": "echo \"Error: no test specified\" &amp;&amp; exit 1"
     },
     "author": "",
     "license": "ISC",
     "dependencies": {
        "request": "2.55.0"
     },
     "devDependencies": {
        "grunt": "0.4.5",
        "grunt-contrib-concat": "0.5.1"
     }
  }
  </code></pre>
  
  <p>Here's to code I'm using, might be helpful.</p>
  
  <pre><code>npm.load('./some/path', function (er) {
      if (er) {
         res.send("er");
      }
      npm.commands.pack(['./another/path'], function (er, data) {
      if (er) {
         res.send("error");
      }
  
      var fileName = __dirname+"/projectName-0.0.3.tgz";
      res.sendFile(fileName, {
           headers: {
               "Content-Type": "application/x-tar"
           }
      });
  });
  </code></pre>