How to use the decompress.tar function in decompress

To help you get started, we’ve selected a few decompress examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codingfriend1 / meanbase / server / api / extensions / extensions.controller.js View on Github external
if(!createdFolderName || !/^[a-zA-Z0-9_-]+$/.test(createdFolderName)) {
        return res.status(501).send('Extension folder name was invalid: "' + createdFolderName + '". It should only contain letters, numbers, and - or _');
      }

      var compressType;
      var decompress = new Decompress();
      switch(contentType) {
        case 'application/x-gzip':
          compressType = Decompress.targz;
          break;
        case 'application/zip':
          compressType = Decompress.zip;
          break;
        case 'application/x-tar':
          compressType = Decompress.tar;
          break;
        case 'application/x-bzip2':
          compressType = Decompress.tar;
          break;
        default:
          compressType = null;
      }

      if(!compressType) {
        return res.status(501).send('Please send a zip, gz, bz2, or tar file type.');
      }

      try {
        // Query the entry
        var stats = fs.lstatSync(createdFolderPath);
        // Is it a directory?
github codingfriend1 / meanbase / server / api / extension / extension.controller.js View on Github external
if(!createdFolderName || !/^[a-zA-Z0-9_-]+$/.test(createdFolderName)) {
        return res.status(501).send('Extension folder name was invalid: "' + createdFolderName + '". It should only contain letters, numbers, and - or _');
      }

      var compressType;
      var decompress = new Decompress();
      switch(contentType) {
        case 'application/x-gzip':
          compressType = Decompress.targz;
          break;
        case 'application/zip':
          compressType = Decompress.zip;
          break;
        case 'application/x-tar':
          compressType = Decompress.tar;
          break;
        case 'application/x-bzip2':
          compressType = Decompress.tar;
          break;
        default:
          compressType = null;
      }

      if(!compressType) {
        return res.status(501).send('Please send a zip, gz, bz2, or tar file type.');
      }

      try {
        // Query the entry
        var stats = fs.lstatSync(app.get('appPath') + 'extensions/' + createdFolderName);
        // Is it a directory?
github codingfriend1 / meanbase / src / services / theme-uploads / unzip.js View on Github external
createdFolderPath = path.join(req.app.get('themesPath'), createdFolderName);

      var compressType;
      var decompress = new Decompress();
      switch(contentType) {
        case 'application/x-gzip':
          compressType = Decompress.targz;
          break;
        case 'application/zip':
          compressType = Decompress.zip;
          break;
        case 'application/x-tar':
          compressType = Decompress.tar;
          break;
        case 'application/x-bzip2':
          compressType = Decompress.tar;
          break;
        default:
          compressType = null;
      }

      if(!compressType) {
        return next(new feathersErrors.NotAcceptable('Please send a zip, gz, bz2, or tar file type.'));
      }

      try {
        // Query the entry
        var stats = fs.lstatSync(createdFolderPath);
        // Is it a directory?
        if (stats.isDirectory()) {
          console.log('already exists');
          return next(new feathersErrors.NotAcceptable('A theme with that name has already been uploaded. Please choose a different folder name for your theme.'));
github codingfriend1 / meanbase / server / api / themes / themes.controller.js View on Github external
createdFolderPath = path.join(app.get('appPath'), 'themes', createdFolderName);

      var compressType;
      var decompress = new Decompress();
      switch(contentType) {
        case 'application/x-gzip':
          compressType = Decompress.targz;
          break;
        case 'application/zip':
          compressType = Decompress.zip;
          break;
        case 'application/x-tar':
          compressType = Decompress.tar;
          break;
        case 'application/x-bzip2':
          compressType = Decompress.tar;
          break;
        default:
          compressType = null;
      }

      if(!compressType) {
        return res.status(501).send('Please send a zip, gz, bz2, or tar file type.');
      }

      try {
        // Query the entry
        var stats = fs.lstatSync(createdFolderPath);
        // Is it a directory?
        if (stats.isDirectory()) {
          return res.status(501).send('A theme with that name has already been uploaded. Please choose a different folder name for your theme.');
        }
github codingfriend1 / meanbase / src / services / extension-uploads / unzip.js View on Github external
return next(new feathersErrors.NotAcceptable('Extension folder name was invalid: "' + createdFolderName + '". It should only contain letters, numbers, and - or _'));
      }

      createdFolderPath = path.join(req.app.get('extensionsPath'), createdFolderName);

      var compressType;
      var decompress = new Decompress();
      switch(contentType) {
        case 'application/x-gzip':
          compressType = Decompress.targz;
          break;
        case 'application/zip':
          compressType = Decompress.zip;
          break;
        case 'application/x-tar':
          compressType = Decompress.tar;
          break;
        case 'application/x-bzip2':
          compressType = Decompress.tar;
          break;
        default:
          compressType = null;
      }

      if(!compressType) {
        return next(new feathersErrors.NotAcceptable('Please send a zip, gz, bz2, or tar file type.'));
      }

      try {
        // Query the entry
        var stats = fs.lstatSync(createdFolderPath);
        // Is it a directory?

decompress

Extracting archives made easy

MIT
Latest version published 5 years ago

Package Health Score

65 / 100
Full package analysis