Click here to Skip to main content
15,914,444 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

how can i save all resources (images, text files, json files,css ... ) of any website ?

i must use nodejs code

thank for help !
Posted

1 solution

Here, have a look:
How can I save objects to files in Node.js?[^]

To serialize your objects to a JSON string:
JavaScript
var str = JSON.stringify(object)

To read it back as an object. (The string can be written to file):
JavaScript
var obj = JSON.parse(string)

For example an object like this:
JavaScript
var p = new Foo();
p.Bar = "Terry"
var s = JSON.stringify(p)
// write s to file, get => { "Bar" : "Terry" }
// read s from file and turn back into an object:
var p = JSON.parse(s);


Further, this is an interesting read: NodeJS and Callbacks[^]
 
Share this answer
 
Comments
VJ Reddy 25-May-12 6:31am    
Nice answer with references. 5!
Sandeep Mewara 25-May-12 15:26pm    
Thanks. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900