npm.io
0.0.19 • Published 12 years ago

requireasync

Licence
Version
0.0.19
Deps
1
Vulns
0
Weekly
0

requireasync

usage

if(!window)var window=eval(require('requireasync').install);else var node=false,browser=true;

    REQUIRE(
        ["fs", "path.resolve"],
    function (err, fs, resolve) {

		    fs.readFile(resolve(".","readme,md"),function(err,data){
			
			    console.log(err,data);
			
		    })
	    }
    )

Shorthand: $R$ can be substituted for REQUIRE

Try this for an instant load and run one liner:

console.log($R$({path:"resolve"})(".","myfile.js"));

See the html folder for a working demo.

change to that folder and type

$ npm install .
$ node demo.js

To load the demo server, and it will give you a local browser url along the lines of

visit http://localhost:8080/index.html to demo the browser files