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

rubric.jsonevals/scenario-4/

{
  "context": "This criteria evaluates how well the engineer uses the tmp-promise package to implement atomic file operations. The focus is on proper usage of tmpName for generating temporary filenames, appropriate error handling with cleanup, and implementing the atomic write pattern (write-to-temp-then-rename).",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Uses tmpName",
      "description": "Uses tmp-promise's tmpName() or tmpNameSync() function to generate a unique temporary filename in the same directory as the target file (using the dir option to specify the target file's directory)",
      "max_score": 30
    },
    {
      "name": "Configures tmpName options",
      "description": "Configures tmpName with appropriate options including dir (to place temp file in same directory as target), and postfix (to use .tmp extension)",
      "max_score": 15
    },
    {
      "name": "Writes to temp file",
      "description": "Writes the new content to the temporary file using Node.js fs methods (writeFile, writeFileSync, or equivalent)",
      "max_score": 15
    },
    {
      "name": "Atomic rename",
      "description": "Performs atomic rename using fs.rename or fs.renameSync to replace the original file with the temporary file",
      "max_score": 15
    },
    {
      "name": "Error handling cleanup",
      "description": "Implements proper error handling that cleans up the temporary file (using fs.unlink or similar) if any errors occur during writing or renaming",
      "max_score": 15
    },
    {
      "name": "Promise-based approach",
      "description": "Uses the async/promise-based version of tmpName (not the sync version) and returns a promise that properly propagates errors and handles async operations correctly",
      "max_score": 10
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/npm-tmp-promise

tile.json