On Sun, Dec 12, 2010 at 03:02:25PM +0800, zwz wrote:
> Hi,
> I want to write a hook that is triggered when finishing downloading
> something, and record the link and target location into a file (by
> emacs).
>
> The problem here is how to write js code to get the link and target
> location of the thing I am downloading.
>
> btw, it seems "~" is the default target dir for downloading, but is
> there a separable variable for that?
>
> Best regards,
> zwz
Something like this:
function foo (info) {
// info.source is an nsIURI of the url that was downloaded.
var url = info.source.spec;
// info.target_file is an nsIFile/nsILocalFile of the target.
var pathstr = info.target_file.path;
}
add_hook('download_finished_hook', foo);
The variable cwd holds the default download directory. Must be set to an
nsILocalFile object (which is the return type of 'make_file') not a
string.
--
John Foerch
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror