Skip to content
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

Plugin Development - need to incrementally write file #956

Open
redabourebaba opened this issue Apr 5, 2024 · 4 comments
Open

Plugin Development - need to incrementally write file #956

redabourebaba opened this issue Apr 5, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@redabourebaba
Copy link

Hello,

Thank you for your great job. I enjoy your application.
I decided to extend the application by developing some plugins.
I will start by developing a visual git management plugin.
In my code, I have to create file, and write data into it.
The creation works fine with fs.createFile(fileName, contents).
I also can write into the file with fs.writeFile(contents).
The problem is that writeFile replaces existing content with the new content.
Is there an option to add the new content without removing existing data ?

Thank you for your help.

@redabourebaba
Copy link
Author

Possible solution is to use "append" to write data to file in SDcard.java Cordova plugin.

Screenshot_2024-04-05-17-14-15-017_com foxdebug acodefree

@deadlyjack
Copy link
Owner

I see, I'll add new fs method append in next update. Thanks for suggestion.

@deadlyjack deadlyjack self-assigned this Apr 6, 2024
@deadlyjack deadlyjack added the enhancement New feature or request label Apr 6, 2024
@redabourebaba
Copy link
Author

If it is possible to implement a nodejs fs library like code, this will be more simple to integrate external libraries, like isomorphic-git per example.
What do you think about it ?
Otherwise, I can continue using a wrapper to map functions.

@bajrangCoder
Copy link
Collaborator

bajrangCoder commented Sep 2, 2024

In my code, I have to create file, and write data into it. The creation works fine with fs.createFile(fileName, contents). I also can write into the file with fs.writeFile(contents). The problem is that writeFile replaces existing content with the new content. Is there an option to add the new content without removing existing data ?

Thank you for your help.

You can easily implement it at your own. By reading the existing content then writing whole new content by combining old and new data

Check here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants