-
-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support save and load payload from file #801
Conversation
6d80bb8
to
076fcbe
Compare
app/src/components/helper/Save.tsx
Outdated
|
||
if (!canceled && filePath !== undefined) { | ||
try { | ||
await fsPromise.writeFile(filePath, buffer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason binary payloads do not get written with correct encoding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The front-end should probably not directly write to the filesystem.
This would block MQTT Explorer from becoming a web-app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved file writing to backend, the read file operation is still in front atm. Same logic is in use for certificate selection
const data = await fsPromise.readFile(selectedFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thomasnordquist moved certificate selection file read to backend too. I have not tested it though since i do not use certs
076fcbe
to
9d09ab2
Compare
Just noticed, how is saving working. |
Files are read/written in default utf-8 for now. I experimented with opening payload from binary file but ran into problems since payload is encoded as string in reducer state from what I gather. To properly support binary payloads I think some refactoring needs to be done to support this. |
Features
Save / Load payload from file
Certificate selection
Publish from file
Save payload to file