Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix "there is no any Buffer" error on browerified version.

  • Loading branch information...
commit e5720131b1a7700d4788a1b4451b240b54f1e309 1 parent f2b3ace
@dervus dervus authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/js-yaml/type/binary.js
View
12 lib/js-yaml/type/binary.js
@@ -4,9 +4,11 @@
'use strict';
-var common = require('../common');
-var NIL = common.NIL;
-var Type = require('../type');
+var NodeBuffer = require('buffer').Buffer; // A trick for browserified version.
+var common = require('../common');
+var NIL = common.NIL;
+var Type = require('../type');
+
var BASE64_PADDING = '=';
@@ -66,7 +68,7 @@ function resolveYamlBinary(object /*, explicit*/) {
if (leftbits) {
return NIL;
} else {
- return new Buffer(result);
+ return new NodeBuffer(result);
}
}
@@ -110,7 +112,7 @@ module.exports = new Type('tag:yaml.org,2002:binary', {
},
dumper: {
kind: 'object',
- instanceOf: Buffer,
+ instanceOf: NodeBuffer,
representer: representYamlBinary
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.