[GH-ISSUE #1273] [Scripting] Appending a current file with writeToFile #1270

Open
opened 2026-03-03 19:49:54 +03:00 by kerem · 1 comment
Owner

Originally created by @NghiaTranUIT on GitHub (Jun 28, 2022).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1273

Originally assigned to: @NghiaTranUIT on GitHub.

Description

Currently, the writeToFile() in the Scripting will override the existed file.

function onResponse(context, url, request, response) {

  // Write to single file
  writeToFile(response.body, "~/Desktop/body.json");
  
  // Write the Body to file with flow ID
  writeToFile(response.body, "~/Desktop/sample-" + context.flow.id);
  
  // Done
  return response;
}

=> Some users would like to append content to the current file, not override them.

Acceptance Criteria

  • Able to Override or Append to the current file
Originally created by @NghiaTranUIT on GitHub (Jun 28, 2022). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1273 Originally assigned to: @NghiaTranUIT on GitHub. ### Description Currently, the `writeToFile()` in the Scripting will override the existed file. ```js function onResponse(context, url, request, response) { // Write to single file writeToFile(response.body, "~/Desktop/body.json"); // Write the Body to file with flow ID writeToFile(response.body, "~/Desktop/sample-" + context.flow.id); // Done return response; } ``` => Some users would like to append content to the current file, not override them. ### Acceptance Criteria - Able to Override or Append to the current file
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 28, 2022):

Done with: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.6.0_writeToFile_by_appending.dmg

Sample

async function onResponse(context, url, request, response) {

  var opt = {appendFile: true}
  writeToFile(response.body, "~/Desktop/body.json", opt);

  // Done
  return response;
}
<!-- gh-comment-id:1168368710 --> @NghiaTranUIT commented on GitHub (Jun 28, 2022): Done with: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.6.0_writeToFile_by_appending.dmg ### Sample ```js async function onResponse(context, url, request, response) { var opt = {appendFile: true} writeToFile(response.body, "~/Desktop/body.json", opt); // Done return response; } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1270
No description provided.