Commit e19d77ec e19d77ec4e7441e45aa374633e13cc70a5d2726d by Nicolas Perriault

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

1 parent b9177adc
1 CasperJS Changelog 1 CasperJS Changelog
2 ================== 2 ==================
3 3
4 XXXX-XX-XX, v0.6.10
5 -------------------
6
7 - fixed [#73](https://github.com/n1k0/casperjs/issues/73) - `Casper.download()` not working correctly with binaries
8 - fixed [#129](https://github.com/n1k0/casperjs/issues/129) - Can't put `//` comments in evaluate() function
9 - 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
10 - fixed [#133](https://github.com/n1k0/casperjs/issues/133) - updated and fixed documentation about [extensibility](http://casperjs.org/extending.html)
11 - added `Casper.clickLabel()` for clicking on an element found by its `innerText` content
12
13 As a side note, the official website monolithic page has been split across several ones: http://casperjs.org/
14
4 2012-05-29, v0.6.9 15 2012-05-29, v0.6.9
5 ------------------ 16 ------------------
6 17
......
1 Subproject commit c49485298b9ed585d7fec76305d96f2689ab8bd4 1 Subproject commit 9ec9627555680a13c411d6b19541f3d23c8f30f7
......
...@@ -153,7 +153,7 @@ var Casper = function Casper(options) { ...@@ -153,7 +153,7 @@ var Casper = function Casper(options) {
153 this.echo('[deprecated] ' + message, 'COMMENT'); 153 this.echo('[deprecated] ' + message, 'COMMENT');
154 }); 154 });
155 155
156 // dispatching an event when configuration is achieved 156 // dispatching an event when instance has been constructed
157 this.emit('init'); 157 this.emit('init');
158 }; 158 };
159 159
...@@ -372,7 +372,7 @@ Casper.prototype.die = function die(message, status) { ...@@ -372,7 +372,7 @@ Casper.prototype.die = function die(message, status) {
372 Casper.prototype.download = function download(url, targetPath, method, data) { 372 Casper.prototype.download = function download(url, targetPath, method, data) {
373 var cu = require('clientutils').create(); 373 var cu = require('clientutils').create();
374 try { 374 try {
375 fs.write(targetPath, cu.decode(this.base64encode(url, method, data)), 'w'); 375 fs.write(targetPath, cu.decode(this.base64encode(url, method, data)), 'wb');
376 this.emit('downloaded.file', targetPath); 376 this.emit('downloaded.file', targetPath);
377 this.log(f("Downloaded and saved resource in %s", targetPath)); 377 this.log(f("Downloaded and saved resource in %s", targetPath));
378 } catch (e) { 378 } catch (e) {
......
1 ### download the google logo image as base64 ### 1 # download the google logo image onto the local filesystem
2 2
3 casper = require('casper').create verbose: true 3 casper = require('casper').create()
4 4
5 casper.start 'http://www.google.fr/', -> 5 casper.start 'http://www.google.fr/', ->
6 @echo @base64encode 'http://www.google.fr/images/srpr/logo3w.png' 6 @echo @download 'http://www.google.fr/images/srpr/logo3w.png', 'logo.png'
7 7
8 casper.run() 8 casper.run()
......
1 // download the google logo image as base64 1 // download the google logo image onto the local filesystem
2 2
3 var casper = require('casper').create({ 3 var casper = require('casper').create();
4 verbose: true
5 });
6 4
7 casper.start('http://www.google.fr/', function() { 5 casper.start('http://www.google.fr/', function() {
8 this.echo(self.base64encode('http://www.google.fr/images/srpr/logo3w.png')); 6 this.download('http://www.google.fr/images/srpr/logo3w.png', 'logo.png');
9 }); 7 });
10 8
11 casper.run(); 9 casper.run();
......