Overview
This prompt aims to guide developers in creating a cleaner API module for a Node.js project, enhancing file management after processing. Developers working on the project will benefit by streamlining file deletion processes while ensuring security and integration with existing code.
Prompt Overview
Purpose: This module provides a secure API for deleting decrypted zip files after processing FXAP files.
Audience: It is intended for developers working with Node.js and Express.js who need file management capabilities.
Distinctive Feature: The module integrates with Discord OAuth for secure access, ensuring only authenticated users can delete files.
Outcome: Users can efficiently manage temporary files, enhancing the overall functionality and security of the application.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Development Tools & DevOps, General Business Operations, Productivity & Workflow
- Techniques: Function Calling / Tool Use, Role/Persona Prompting, Structured Output
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 5-10 minutes
- Skill level: Intermediate
Variables to Fill
- [method: 'POST'] – Method: 'post'
- [sessionId] – Sessionid
Example Variables Block
- [sessionId]: abc123xyz
The Prompt
Create a new “cleaner” API module for the provided Node.js project that programmatically clears or deletes files from the decrypted zip archives after decoding FXAP files with FiveM. This module should be seamlessly integrated into the existing Express.js server codebase.
**Requirements:**
– Implement this in Node.js as a new API route/module within the existing project structure.
– The module should expose endpoints to trigger the cleaning (deleting) of decrypted zip files securely after processing.
– Ensure the deletion only affects files generated by the decryption process (e.g., the zip files stored for download).
– Provide an example HTML + CSS + JS front-end page or snippet that interacts with the new cleaner API endpoint to trigger file cleanup.
– Use best practices for authentication and error handling, leveraging existing Discord OAuth login middleware.
– Add the new module and route to the existing Express.js server code (provided in the project code) without breaking existing functionality.
**Details and Instructions:**
– Your Node.js module should export a class or functions responsible for deleting/cleaning decrypted zip files.
– Provide a new Express route, e.g., `POST /api/clean/:sessionId`, which, when called after authentication, deletes the corresponding session’s zip file.
– Confirm file existence and handle errors gracefully.
– The front-end code should show a button or control on a page (e.g., `decrypt.html`) that calls the cleaner API to remove the file related to the given session.
– Keep the UI simple but functional, with fetch calls and appropriate success/failure messages.
– Use existing session management (session ID passed as a parameter) and read the session zip path from the `decryptAPI` state if needed.
– Your response should include the full Node.js cleaner module code, the Express integration code snippet, and the front-end JS + HTML snippet.
**Additional Considerations:**
– Maintain the current code style and conventions.
– Security: only allow logged-in Discord users to use the cleaner endpoint.
– Avoid removing any user input or configurations unrelated to file cleaning.
**Steps:**
1. Write a Node.js cleaner module that deletes zip files by session ID.
2. Add an Express route `/api/clean/:sessionId` with Discord login middleware for security.
3. Connect the route with the cleaner module to delete the file if it exists.
4. Add front-end UI code that calls the cleaner API for a given session.
5. Handle success and error responses appropriately in the UI.
**Output Format:**
Provide the following as separate labeled code blocks:
6. Cleaner Module Source Code (Node.js)
7. Express Route Integration Code Snippet (to be added in the main server file)
8. Front-end HTML + JS Snippet (to be included in `decrypt.html` or linked frontend)
**Notes:**
– Use placeholders for any dynamic values like `[sessionId]`.
– Assume `decryptAPI` instance is accessible for retrieving session zip paths.
– Do not modify existing decrypt logic; only add new cleaning-related code.
**Example (simplified):**
“`javascript
// Node.js cleaner module exports a clean(sessionId) function
// Express POST /api/clean/:sessionId calls clean and returns JSON
// Front end calls fetch(‘/api/clean/’+sessionId, [method: ‘POST’]) on button click
“`
Screenshot Examples
How to Use This Prompt
- [CLEANER_MODULE]: Node.js module for file deletion.
- [EXPRESS_ROUTE]: API route for cleaning files.
- [SESSION_ID]: Unique identifier for user sessions.
- [AUTH_MIDDLEWARE]: Discord OAuth for secure access.
- [FILE_PATH]: Path to the decrypted zip files.
- [ERROR_HANDLING]: Manage errors during file operations.
- [FRONT_END]: UI for triggering file cleanup.
- [SUCCESS_MESSAGE]: Feedback for successful deletions.
Tips for Best Results
- Cleaner Module Implementation: Create a Node.js module that exports a function to delete zip files based on the session ID, ensuring it checks for file existence and handles errors gracefully.
- Express Route Setup: Add a new route in your Express server that uses Discord OAuth middleware to secure the endpoint, allowing only authenticated users to trigger the file cleanup.
- Front-end Interaction: Develop a simple HTML page with a button that, when clicked, sends a POST request to the cleaner API endpoint using fetch, and displays success or error messages based on the response.
- Security and Error Handling: Implement robust error handling in both the Node.js module and the front-end code, ensuring that only authorized users can access the cleaning functionality and that all potential errors are communicated clearly to the user.
FAQ
- What is the purpose of the cleaner API module?
The cleaner API module deletes decrypted zip files after processing FXAP files securely. - How does the Express route for cleaning files work?
The route '/api/clean/:sessionId' triggers file deletion for the specified session ID. - What security measures are implemented in the cleaner module?
The module uses Discord OAuth middleware to ensure only authenticated users can access it. - How does the front-end interact with the cleaner API?
The front-end uses a button to call the cleaner API, triggering file cleanup via fetch.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


