File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 14
14
.nyc_output
15
15
.vscode /
16
16
package-lock.json
17
+ .idea
Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ function toFile (fileOut, callback) {
92
92
function toBuffer ( options , callback ) {
93
93
if ( is . object ( options ) ) {
94
94
this . _setBooleanOption ( 'resolveWithObject' , options . resolveWithObject ) ;
95
+ } else if ( this . options . resolveWithObject ) {
96
+ this . options . resolveWithObject = false ;
95
97
}
96
98
return this . _pipeline ( is . fn ( options ) ? options : callback ) ;
97
99
}
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const assert = require ( 'assert' ) ;
4
+
5
+ const sharp = require ( '../../' ) ;
6
+ const fixtures = require ( '../fixtures' ) ;
7
+
8
+ describe ( 'toBuffer' , ( ) => {
9
+ it ( 'reusing same sharp object does not reset previously passed parameters to toBuffer' , ( done ) => {
10
+ let image = sharp ( fixtures . inputJpg ) ;
11
+ image . toBuffer ( { resolveWithObject : true } ) . then ( ( obj ) => {
12
+ image . toBuffer ( ) . then ( ( buff ) => {
13
+ assert . strict . equal ( Buffer . isBuffer ( buff ) , true ) ;
14
+ assert . strict . equal ( typeof obj , 'object' ) ;
15
+ done ( ) ;
16
+ } ) ;
17
+ } ) ;
18
+ } ) ;
19
+ } ) ;
You can’t perform that action at this time.
0 commit comments