how to call a module in NW - Forum

Forum Navigation
You need to log in to create posts and topics.

how to call a module in NW

I can't imagine how i can call or require a module inside Visualneoweb from NW.js

I want to call the file system module..

var fs = require('fs'); fs.readFile('./package.json', 'utf-8', function (error, contents) { document.write(contents); });

@emmanuel-fernandez Try this:

BeginJS
  var fs = require('fs');
  fs.writeFile("test.txt", "This is the saved text!", function(err) {
     if(err) {
       alert("error");
     }
  });
EndJS

It will write a file with name "test.txt" within the package.ws folder.
I think your sample code is fine but not the path.

Great!! it works, thank's a lot