Skip to content

Commit f0e34da

Browse files
author
Mark Cavage
committed
minor patch to allow reading of strings as buffers
1 parent abb2057 commit f0e34da

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/ber/reader.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Reader.prototype.readEnumeration = function() {
146146
};
147147

148148

149-
Reader.prototype.readString = function(tag) {
149+
Reader.prototype.readString = function(tag, retbuf) {
150150
if (!tag)
151151
tag = ASN1.OctetString;
152152

@@ -171,11 +171,10 @@ Reader.prototype.readString = function(tag) {
171171
if (this.length === 0)
172172
return '';
173173

174-
var str =
175-
this._buf.slice(this._offset, this._offset + this.length).toString('utf8');
174+
var str = this._buf.slice(this._offset, this._offset + this.length);
176175
this._offset += this.length;
177176

178-
return str;
177+
return retbuf ? str : str.toString('utf8');
179178
};
180179

181180

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"author": "Mark Cavage <mcavage@gmail.com>",
33
"name": "asn1",
44
"description": "Contains parsers and serializers for ASN.1 (currently BER only)",
5-
"version": "0.1.5",
5+
"version": "0.1.6",
66
"repository": {
77
"type": "git",
88
"url": "git://github.com/mcavage/node-asn1.git"

0 commit comments

Comments
 (0)