Trouble saving files correctly on Node-Webkit

0 favourites
  • 4 posts
From the Asset Store
Match the similar cards with each other and free all animals!
  • I am currently in the middle of developing a CRM, to be exported using Node-Webkit. I'm quite happy with my progress so far; the application is stable and extremely secure. It uses encryption, input validation (via regex), heavy filesystem expressions, etc.

    However, there is one thing which is making part of it very difficult.

    At the moment, the way it works is a user logs in and from there, they can choose to enter a new customer's details; once all details are entered, the application pops up a save dialog and allows the user to save the information they have entered as a print-ready XFDF file (Adobe auto-filling PDF). After it is saved, the application opens the file for convenience.

    After this is done, a dialog box pops up asking "Do you want to save this customer's information?"

    If yes is chosen, the application should automatically save an encrypted file with all the user's information, in a specific folder - formatted ready for viewing as a record in the application later.

    The issue I'm facing, is that I cannot find a way to make Node-Webkit save files without the use of the Save dialog. It's important that this is done without letting the user choose the location or name, because the file needs to be saved in a specific folder (with all the rest of the customer files), with a specific name (auto-generated token).

    I've tried a few different things including:

    -Node-Webkit's 'Write File' action, using a preset path instead of telling it to use the input from the save dialog... nothing happens

    -Browser's 'Invoke download of string' action... nothing happens

    What's the best way to achieve this?

    If I can get this working, it'd also be nice to make the XFDF file save in the background too, in a preset location and with a preset name, etc.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you are using Node-Webkit, try setting the full path to a variable then calling Node.js directly with Browser -> Execute Javascript:

    "var fs = require('fs');fs['writeFileSync'](arguments here)"

    See the fs syntax here:

    I hope this helps.

  • according to the manual ( ... ode-webkit using this link, as there is a bug in the node webkit entry currently), the write file action may let you do this. however, not sure you can create a file everywhere without admin permissions (you should be able to use the user folder, but everything in the program files is no go IIRC)

  • Thanks guys. I'll try that.

    Permissions shouldn't be an issue; the end user is fine with running the program with elevated privileges each time.

    Love the Colgate, by the way. gg Aphrodite

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)