CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-tmp-promise

The tmp package with promises support and disposers.

93

1.78x
Overview
Eval results
Files

task.mdevals/scenario-6/

Unique Filename Generator Service

A service that generates unique temporary filenames for various application modules, each with specific naming requirements.

Capabilities

Generate filenames with custom patterns

  • When generating a filename with prefix 'logs-' and postfix '.txt', returns a unique path ending with '.txt' and starting with the configured prefix @test
  • When generating a filename with template '/tmp/myapp-XXXXXX', returns a path matching the template pattern with XXXXXX replaced by random characters @test

Generate filenames for multiple modules

  • When generating filenames for a 'cache' module (prefix 'cache-', postfix '.dat') and a 'session' module (prefix 'session-', postfix '.json'), each generated filename has its respective prefix and postfix @test

Validate generated filenames

  • Generated filenames are strings and contain a path separator character @test

Implementation

@generates

API

/**
 * Generates a unique temporary filename with the specified options.
 *
 * @param {Object} options - Configuration for filename generation
 * @param {string} [options.prefix] - Prefix for the filename
 * @param {string} [options.postfix] - Suffix/extension for the filename
 * @param {string} [options.template] - Template pattern with XXXXXX placeholder
 * @returns {string} A unique temporary filename path
 */
function generateTempFilename(options) {
  // IMPLEMENTATION HERE
}

/**
 * Generates multiple unique temporary filenames for different application modules.
 *
 * @param {Object} moduleConfigs - Map of module names to their filename configurations
 * @returns {Object} Map of module names to their generated filenames
 */
function generateModuleFilenames(moduleConfigs) {
  // IMPLEMENTATION HERE
}

module.exports = {
  generateTempFilename,
  generateModuleFilenames
};

Dependencies { .dependencies }

tmp-promise { .dependency }

Provides temporary file and directory creation with promise support.

Install with Tessl CLI

npx tessl i tessl/npm-tmp-promise

tile.json