Commit e19d77ec e19d77ec4e7441e45aa374633e13cc70a5d2726d by Nicolas Perriault

fixed #73 - fixed Casper.download() wasn't capable of saving binaries properly

1 parent b9177adc
CasperJS Changelog
==================
XXXX-XX-XX, v0.6.10
-------------------
- fixed [#73](https://github.com/n1k0/casperjs/issues/73) - `Casper.download()` not working correctly with binaries
- fixed [#129](https://github.com/n1k0/casperjs/issues/129) - Can't put `//` comments in evaluate() function
- closed [#130](https://github.com/n1k0/casperjs/issues/130) - Added a `Dummy` [colorizer](http://casperjs.org/api.html#colorizer) class, in order to disable colors in console output
- fixed [#133](https://github.com/n1k0/casperjs/issues/133) - updated and fixed documentation about [extensibility](http://casperjs.org/extending.html)
- added `Casper.clickLabel()` for clicking on an element found by its `innerText` content
As a side note, the official website monolithic page has been split across several ones: http://casperjs.org/
2012-05-29, v0.6.9
------------------
......
Subproject commit c49485298b9ed585d7fec76305d96f2689ab8bd4
Subproject commit 9ec9627555680a13c411d6b19541f3d23c8f30f7
......
......@@ -153,7 +153,7 @@ var Casper = function Casper(options) {
this.echo('[deprecated] ' + message, 'COMMENT');
});
// dispatching an event when configuration is achieved
// dispatching an event when instance has been constructed
this.emit('init');
};
......@@ -372,7 +372,7 @@ Casper.prototype.die = function die(message, status) {
Casper.prototype.download = function download(url, targetPath, method, data) {
var cu = require('clientutils').create();
try {
fs.write(targetPath, cu.decode(this.base64encode(url, method, data)), 'w');
fs.write(targetPath, cu.decode(this.base64encode(url, method, data)), 'wb');
this.emit('downloaded.file', targetPath);
this.log(f("Downloaded and saved resource in %s", targetPath));
} catch (e) {
......
### download the google logo image as base64 ###
# download the google logo image onto the local filesystem
casper = require('casper').create verbose: true
casper = require('casper').create()
casper.start 'http://www.google.fr/', ->
@echo @base64encode 'http://www.google.fr/images/srpr/logo3w.png'
@echo @download 'http://www.google.fr/images/srpr/logo3w.png', 'logo.png'
casper.run()
......
// download the google logo image as base64
// download the google logo image onto the local filesystem
var casper = require('casper').create({
verbose: true
});
var casper = require('casper').create();
casper.start('http://www.google.fr/', function() {
this.echo(self.base64encode('http://www.google.fr/images/srpr/logo3w.png'));
this.download('http://www.google.fr/images/srpr/logo3w.png', 'logo.png');
});
casper.run();
......