...

View Full Version : fs.open



liderbug
03-09-2012, 02:03 PM
Noob, Linux, lost...

I found a bit of sample code I want to mod&use that starts with:
var fs = require("fs"); then later fs.open, fs.write/read...

I've scanned the web, searched codingforums and the best I can come up with is NodeJS. I did a download/install and .... no joy.

Thank you.

Never mind (for now) it was really late, tired, not thinking (I do that a lot these days) and I CAN"T TPYE.

I'm back. configure, make, make install -> 'install' finished successfully' - My first time adding external JS modules? I now have a file "fs.js". The code blows out on the first line: var fs = require("fs"); I've tried req(fs.js) with no luck. What do I need to do?

Thanks

blaze4218
03-09-2012, 06:41 PM
There is no require, or include capacity of any kind in javascripts core language. You have to write your own. This has been done by many, and exists in a few libraries already. Google "javascript dynamic script loading"

felgall
03-09-2012, 07:59 PM
var require = function(nm) {
var s = document.createElement('script');
s.type='text/javascript';
s.src=nm;
document.getElementsByTagName('body')[0].appendChild(s);
}

require("fs");



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum