The /file/decompress Robot

Transloadit can both archive and extract entire media libraries.

The /file/decompress Robot Extracts entire archives of files to be consumed by other Robots or exported as individual files.

Parameters

Name Type Default Description
ignore_errors Boolean false There might be an error coming up when trying to extract meta data from the files inside your archive. This happens for files that are zero bytes big for example. Setting this to true will cause the Robot to not stop the file decompression (and the entire Assembly) when that happens.

Example use cases

Our /file/decompress Robot can be used in combination with other Robots, to create powerful workflows unique to your use case.
Here are a few example scenarios, and the required the Assembly Instructions to implement them.
You can also try demos of these examples right here, live on our website.

Extract all images from an archive and resize them

{
  "steps": {
    "extract": {
      "use": ":original",
      "robot": "/file/decompress"
    },
    "resize": {
      "robot": "/image/resize",
      "use": "extract",
      "result": true,
      "width": 200,
      "height": 200,
      "resize_strategy": "pad"
    }
  }
}

Automatically extract all files from an archive

{
  "steps": {
    "extract": {
      "use": ":original",
      "robot": "/file/decompress",
      "result": true
    }
  }
}

Automatically extract uploaded archives

{
  "steps": {
    "archives": {
      "use": ":original",
      "robot": "/file/filter",
      "accepts": [
        [
          "${file.mime}",
          "regex",
          "application/(rar|x-7z-compressed|x-cab|x-cpio|x-debian-package|x-gtar-compressed|x-gzip|x-lzh|x-redhat-package-manager|x-tar|zip)"
        ]
      ],
      "error_on_decline": false
    },
    "non-archives": {
      "use": ":original",
      "robot": "/file/filter",
      "declines": [
        [
          "${file.mime}",
          "regex",
          "application/(rar|x-7z-compressed|x-cab|x-cpio|x-debian-package|x-gtar-compressed|x-gzip|x-lzh|x-redhat-package-manager|x-tar|zip)"
        ]
      ],
      "error_on_decline": false
    },
    "extracted": {
      "use": "archives",
      "robot": "/file/decompress"
    },
    "encoded-ipad": {
      "use": [
        "non-archives",
        "extracted"
      ],
      "robot": "/video/encode",
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high",
      "result": true
    },
    "encoded-webm": {
      "use": [
        "non-archives",
        "extracted"
      ],
      "robot": "/video/encode",
      "ffmpeg_stack": "v2.2.3",
      "preset": "webm",
      "result": true
    },
    "exported": {
      "use": [
        ":original",
        "encoded-ipad",
        "encoded-webm"
      ],
      "robot": "/s3/store",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET",
      "bucket": "YOUR_S3_BUCKET"
    }
  }
}

Related blog posts

Over the years we wrote the following posts about Our /file/decompress robot on our blog:

Did you know?

You can easily combine Robots to create powerful workflows, unique to your business.
This is the power of Transloadit.