Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

AnimatedGif now returns Buffer

  • Loading branch information...
commit f895a8bd2092fcf8c22c3b3d36874d68e29a0554 1 parent 9c9bfa3
@pkrumins authored
Showing with 5 additions and 4 deletions.
  1. +4 −3 src/animated_gif.cpp
  2. +1 −1  tests/animated-gif/animated-gif.js
View
7 src/animated_gif.cpp
@@ -204,9 +204,10 @@ AnimatedGif::GetGif(const Arguments &args)
AnimatedGif *gif = ObjectWrap::Unwrap<AnimatedGif>(args.This());
gif->gif_encoder.finish();
- return scope.Close(
- Encode((char *)gif->gif_encoder.get_gif(), gif->gif_encoder.get_gif_len(), BINARY)
- );
+ int gif_len = gif->gif_encoder.get_gif_len();
+ Buffer *retbuf = Buffer::New(gif_len);
+ memcpy(retbuf->data(), gif->gif_encoder.get_gif(), gif_len);
+ return scope.Close(retbuf->handle_);
}
Handle<Value>
View
2  tests/animated-gif/animated-gif.js
@@ -41,5 +41,5 @@ chunkDirs.forEach(function (dir) {
var gif = animatedGif.getGif();
-fs.writeFileSync('animated.gif', gif, 'binary');
+fs.writeFileSync('animated.gif', gif.toString('binary'), 'binary');
Please sign in to comment.
Something went wrong with that request. Please try again.