Comments (5)
Thanks for your input. I guess I can support a simple version of isFileExist()
and readFile()
for you 👍
from proxyman.
Thanks for your input. I guess I can support a simple version of
isFileExist()
andreadFile()
for you 👍
I'm very much looking forward to your new version. I wonder if it will support using JSON parsing to read the contents of files. This way, I can compare file contents more conveniently and specifically.
async function onResponse(context, url, request, response) {
const filename = request.queries.page;
const path_to_local_file = "~/Desktop/" + filename + ".json"
if ("path_to_local_file not exists or path_to_local_file content is empty") {
writeToFile(response.body, path_to_local_file);
} else {
var local_file_json = JSON.parse(path_to_local_file's content)
if (local_file_json.some_value != response.body.some_value) {
// to update local file
writeToFile(response.body, path_to_local_file);
} else {
// no nothing or just print some log
}
}
return response;
}
from proxyman.
@andforce you can try this Beta build: https://download.proxyman.io/beta/Proxyman_5.3.0_New_file_common_func.dmg
- Add:
isFileExists()
- Add:
readFromFile()
- Snippet Code: https://docs.proxyman.io/scripting/snippet-code#read-a-file
async function onResponse(context, url, request, response) {
const textFilePath = "~/Desktop/myfile.json";
// check exist
if (isFileExists(filePath)) {
// read from file
const text = readFromFile(textFilePath);
// pares string to JSON Object
const obj = JSON.parse(text);
}
// Read binary file
const binaryFilePath = "~/Desktop/screenshot.png";
const binaryFile = readFromFile(binaryFilePath); // Uint8Array
// Done
return response;
}
from proxyman.
@NghiaTranUIT Thank you very much; I am amazed by your efficiency. I tried the new beta version you provided, it works fine~
from proxyman.
Awesome, glad it helps you 👍
from proxyman.
Related Issues (20)
- [BUG][Compose] Make a request to `localhost:3000` will stuck until the timeout HOT 1
- Windows10 When i close proxyman,System Proxy auto closed. HOT 3
- Activate License Key with External Proxy HOT 2
- DELETE method with no response body or cached methods do not appear under JSON filter. HOT 2
- Why u remove 3 proxyman dock icons? HOT 2
- SSL Handshake Failed When Using Proxyman with Modified Device Time HOT 6
- Does support override host file split by app HOT 1
- Proxyman incorrectly display header HOT 5
- Query value not decode at Query Panel. HOT 3
- Update "Try Proxyman macOS" on iOS
- SSL Handshake Failed on iOS 17.4 simulator HOT 3
- [iOS] Reorder the Map Local and Breakpoint Rules
- Executing multiple scripts HOT 1
- [UI/UX] Improve UI HOT 2
- Support "Copy as" for multiple Request Selection HOT 1
- Support: Copy as "Markdown Table" HOT 1
- Add support custom terminal like iterm2 for automatic setup HOT 6
- No traffic when using `rustls-tls` HOT 3
- Add ability to inspect Tailscale traffic HOT 3
- Why I cannot see OPTIONS requests in the list? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proxyman.