Key generator for the files The key generator is used to generate a key for a file based on a given pattern. The key pattern can contain placeholders that will be replaced by the actual values. The placeholders are enclosed in curly braces and the following are supported by default:

  • {_filename}: The name of the file
  • {_extension}: The extension of the file
  • {_timestamp}: The timestamp when the file was processed in milliseconds
  • {_date}: The date when the file was processed in the format YYYY-MM-DD
  • {_time}: The time when the file was processed in the format HH-mm-ss
  • {_datetime}: The date and time when the file was processed in the format YYYY-MM-DD_HH-mm-ss
  • {_year}: The year when the file was processed
  • {_month}: The month when the file was processed
  • {_day}: The day when the file was processed
  • {_hour}: The hour when the file was processed
  • {_minute}: The minute when the file was processed
  • {_second}: The second when the file was processed

Other placeholders can be added by appling a custom file pattern over the file name, and using default values:

  • file name: mySensor_flowMeter1_2024-12-30_2024-12-31.jsonl
  • file pattern: {sensor}{measurement}{year}-{month}-{day}_{end}
  • default values: {source: 'myFileFlinger1'}
  • key pattern: {sensor}/{measurement}/{year}/{month}/{day}/data_{source}
  • key: mySensor/flowMeter1/2024/12/30/data_myFileFlinger1

Constructors

Methods

Constructors

Methods

  • Generates a key for a file based on a given pattern.

    Parameters

    • filePath: string

      The path to the file.

    Returns string

    The generated key.