[Fix #480] capturePage using node buffer #1638

Merged
merged 2 commits into from Mar 3, 2014

Conversation

Projects
None yet
2 participants
@FWeinb
Contributor

FWeinb commented Feb 28, 2014

This is my first attempt of implementing node buffers into the screenshot mechanism asked in Issue #480.

With this pull request I extended the capturePage API and provide legacy support.

The new signature is capturePage(callback, [String || Object])
String: jpeg or png
Object: { format : "[jpeg|png]", datatype : "[raw|buffer|datauri]" }
Defaults are:
format: jpeg
datatype: datauri

Examples:

// jpeg as datauri
win.capturePage(function(datauri){
 // do something with the datauri
});

// png as datauri 
win.capturePage(function(datauri){
 // do something with the datauri
}, 'png');

// Extended API 

// png as datauri
win.capturePage(function(datauri){
 // do something with the datauri
}, { format : 'png' } );

// png as node buffer
win.capturePage(function(buffer){
 // do something with the buffer
}, { format : 'png', datatype : 'buffer'} );

// png as base64string
win.capturePage(function(base64string){
 // do something with the base64string
}, { format : 'png', datatype : 'raw'} );


rogerwang added a commit that referenced this pull request Mar 3, 2014

@rogerwang rogerwang merged commit 7a9f258 into nwjs:master Mar 3, 2014

@rogerwang

This comment has been minimized.

Show comment Hide comment
@rogerwang

rogerwang Mar 3, 2014

Member

Thanks. Please update the wiki document.

Member

rogerwang commented Mar 3, 2014

Thanks. Please update the wiki document.

@rogerwang rogerwang added this to the v0.9.3 milestone Mar 3, 2014

@FWeinb

This comment has been minimized.

Show comment Hide comment
@FWeinb

FWeinb Mar 3, 2014

Contributor

Updated the wiki to include changes described here. I assumed that this will be included in the next release (v0.9.3)

Contributor

FWeinb commented Mar 3, 2014

Updated the wiki to include changes described here. I assumed that this will be included in the next release (v0.9.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment