How to save url as text file in chrome using javascript

hi,
i want to create a extension for chrome using which i can save the current tab url in a text file.

thanks
sanjay