how to readFile before writeToFile()
@NghiaTranUIT is already working on this.
Since May 14, 2024.
Assessment
This issue has not been assessed yet.
Description
I understand that ProxyMan provides the functionality to save response.body to a file using the writeToFile() function,
but I seem to have not found a function to read files.
I want to add some conditions before writing to the file, such as whether the file exists and the content of the file,
to determine whether I want to save the file.
In short, I don't want to directly overwrite the existing file.
Here is some pseudocode, as I have not found a relevant implementation method.
async function onResponse(context, url, request, response) {
const filename = request.queries.page;
const path = "~/Desktop/" + filename + ".json"
if ("path not exists or content is different from ${response.body}") {
writeToFile(response.body, path);
} else {
// just print some log
}
return response;
}
- Dominant language
- No language data
- Stars
- 7k
- Forks
- 237
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ProxymanApp/Proxyman
-
✅ Done enhancement
ProxymanApp/Proxyman#2772 · 1 comment · 1 assignee ·
-
✅ Done enhancement
ProxymanApp/Proxyman#2771 · 1 comment · 1 assignee ·
-
bug
ProxymanApp/Proxyman#2770 · 1 assignee ·
-
✅ Done bug
ProxymanApp/Proxyman#2769 · 2 comments · 1 assignee ·
-
✅ Done enhancement
ProxymanApp/Proxyman#2768 · 1 comment · 1 assignee ·