Link to home
Start Free TrialLog in
Avatar of zizi21
zizi21

asked on

Create URL in javascript node js

Hi All,

I have the following url:

        var url = "http://test/global.html";
This url will then be sent to the unfluff module like this:
     
      var data = unfluff(url,'en');

It appears that unfluff can't seem to detect the url . Thought maybe, it is the way, I constructed the url. Is there a module to create a url to pass it to the unfluff module instead of just using string.

Thanks a lot
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

It appears that 'unfluff' is expecting a file or local variable, not a URL.  The demo code on this page https://github.com/ageitgey/node-unfluff uses cURL to get the content of URLs.
Avatar of zizi21
zizi21

ASKER

Thanks Dave Baldwin.

I have even tried to save the file locally and it does not work from the code.
What do you get?  That demo page says it outputs data in JSON format.
Avatar of zizi21

ASKER

In the command line, I have tried unfluff test.html and it works  where test.html is stored locally.

But, in the code, it does not work. Could it be that test.html needs to be written in a url understood by node js javascript.
Avatar of zizi21

ASKER

I get the json object when i test it in command line.
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zizi21

ASKER

Thanks so much!
You're welcome, glad to help.