Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Allows to test some file variables to decide to execute command set.

see also check

parameters

  • filter: the selector

    • a string
      considered as the extension of the file to match with (equals), or the mimetype to match with (equals or starts with)

    • a string array, as a list of file extensions or mimetypes to match with

    • a json object, as an conditional expression (logical and combination)

      • property as a variable

        • extension: extension of current file

        • mimetype: mimetype of current file

        • name: name of current file

        • basename: name (without extension) of current file

        • path: relative to san path of the current file

        • length: length of current file (bytes)

        • lastmodified: last modified timestamp (unix epoch time) of current file

        • width: pixel width of current file

        • height: pixel height of current file

        • xdpi: horizontal density in dots per inch of current file

        • ydpi: vertical density in dots per inch of current file

        • original.extension: extension of original file

        • original.mimetype: mimetype of original file

        • original.name: name of original file

        • original.basename: name (without extension) of original file

        • original.path: relative to san path of the original file

        • original.length: length of original file (bytes)

        • original.lastmodified: last modified timestamp (unix epoch time)

        • original.width: pixel width of original file

        • original.height: pixel height of original file

        • original.xdpi: horizontal density in dots per inch of original file

        • original.ydpi: vertical density in dots per inch of original file

          Value is the test to be performed, as

          • a simple value, to check if the variable is equal to
            Example:

            Code Block
            languagejson
            "filter": {
                "extension":"jpg"
            }
          • an object, as logical and combination, where property name is an operator and value is the value to used with the operator, or an array of values (logical or combination)

          • an array, as logical or combination of all items
            Example 1:

            Code Block
            {
               "filter": {
                   "extension":["jpg","png"]
               }
            }

            Example 2:

            Code Block
            {
               "filter": {
                   "mimetype":["application/pdf",{"startswith":"image/"}]
               }
            }


      • property as a logical operator

        • or: the value must be an array of conditions

          example:

          Code Block
          languagejson
          {
             "filter": {
                "or": [
                        {"path": {"ct":"/asset/"}},
                        {"path": {"ct":"/legacy/"}}
                    ]
                ]
             }
          }
        • and: The value must be an array of conditions.

          example:

          Code Block
          languagejson
          {
             "filter": {
                "and": [
                        {"extension":"jpg"},
                        {"length":{"<":"2MiB"}}
                    ]
                ]
             }
          }
        • not: the value must be an object (conditional expression)

          example:

          Code Block
          languagejson
          {
             "filter": {
                "not": {
                    "extension": ["zip","mp4"]          ]
                }
             }
          }


    • an array, as a combination table of the above types
      Example:

      Code Block
      {
         "filter": [
             {
                 "extension":"jpg"
             },
             {
                 "extension":"png",
                 "length":{"<":"2MiB"}
             }
         ]
      }

  • if: action to do if file matches selector

  • else: action to do if file doen’t match selector

...