Browse files

* Fixed: buffer objects mangled when gzipped

  • Loading branch information...
1 parent 22f22a7 commit c9f19d4b568f29e0783caeb46cfc53d53674bd1f @joehewitt committed Sep 1, 2011
Showing with 6 additions and 2 deletions.
  1. +5 −1 lib/Cache.js
  2. +1 −1 package.json
View
6 lib/Cache.js
@@ -281,7 +281,11 @@ subclass(Cache, events.EventEmitter, {
_storeAndZip: function(URL, keys, data, cb) {
if (this.useMem) {
if (this.useGzip && data.body) {
- gzip(data.body, _.bind(function(err, gzipped) {
+ var body = data.body;
+ if (body && body.toString) {
+ body = body.toString('utf8');
+ }
+ gzip(body, _.bind(function(err, gzipped) {
data.bodyZipped = gzipped;
this._storeInMemCache(URL, keys, data);
cb(0, data, true);
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "diskcache",
"description": "Caches data on disk and optionally in memory.",
- "version": "0.0.4",
+ "version": "0.0.5",
"homepage": "http://github.com/joehewitt/diskcache",
"repository": {
"type": "git",

0 comments on commit c9f19d4

Please sign in to comment.