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)
- Update Atlantis UI to easier to config HOT 1
- Your connection isn't private HOT 5
- The JSON array in response or request displays an exception, such as the field group_ids shown in the following image HOT 2
- [BUG] ReverseProxy and Scripting: Can not make a HTTP Request HOT 1
- How to interrupt an existing WebSocket connection? HOT 2
- I can no longer debug apps on the AppStore. -SSL HandShake Error HOT 5
- Allow Wildcards in Client Certificate Host and Port HOT 5
- Proxy URLs display IP addresses instead of Hostnames HOT 2
- Add Japanese support HOT 2
- Proxyman Windows Code Generator
- SOCKS Proxy in Proxyman routes traffic to the Host header instead of the specified SOCKS destination HOT 6
- No more copy as cURL? version 5.7.0 HOT 3
- After purchasing, I was not satisfied with the functionality I experienced. I applied for a refund but no one replied, which is really bad. HOT 1
- [Map Local] Improve UX: Show a yellow warning comment if the Map Local doesn't map due to missing local file HOT 1
- FR: breakpoint shortcut should toggle breakpoints, just like caching shortcut and proxy overridden shortcut HOT 1
- The application freezes when trying to open Map Local HOT 3
- 解ζ protobuf response body ζη€ΊζΎδΈε° ζΆζ―η±»ε
- Proxyman not capturing traffic on NextJS Edge runtime (middleware) HOT 3
- Unable to capture any network traffic from Zed editor HOT 2
- Map Local directory endpoint name colliding with file and folder 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.