We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e2ed23 commit c325767Copy full SHA for c325767
bencode.js
@@ -7,8 +7,8 @@
7
*/
8
function encode( data ) {
9
10
- if( Buffer.isBuffer( data ) )
11
- return encode.bytes( data )
+ if( data instanceof Buffer )
+ return data.length + ':' + data
12
13
switch( typeof data ) {
14
case 'string':
@@ -27,8 +27,6 @@ function encode( data ) {
27
}
28
29
encode.bytes = function( data ) {
30
- if( data instanceof Buffer )
31
- return data.length + ':' + data
32
return Buffer.byteLength( data ) + ':' + data
33
34
0 commit comments