File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -542,6 +542,31 @@ if (typeof (BinData) != "undefined") {
542
542
BinData . prototype . length = function ( ) {
543
543
return this . len ;
544
544
} ;
545
+
546
+ BinData . prototype . nativeToString = BinData . prototype . toString ;
547
+ BinData . prototype . toString = function ( encoding ) {
548
+ if ( encoding ) {
549
+ return this . nativeToString ( encoding ) ;
550
+ }
551
+ return `BinData(${ this . type } , ${ this . base64 ( ) } )` ;
552
+ } ;
553
+
554
+ BinData . prototype . base64 = function ( ) {
555
+ return this . toString ( "base64" ) ;
556
+ } ;
557
+ BinData . prototype . hex = function ( ) {
558
+ return this . toString ( "hex" ) ;
559
+ } ;
560
+ Object . defineProperty ( BinData . prototype , "len" , {
561
+ get : function ( ) {
562
+ return this . buffer ? this . buffer . byteLength : 0 ;
563
+ } ,
564
+ } ) ;
565
+ Object . defineProperty ( BinData . prototype , "type" , {
566
+ get : function ( ) {
567
+ return this . sub_type ;
568
+ } ,
569
+ } ) ;
545
570
} else {
546
571
print ( "warning: no BinData class" ) ;
547
572
}
You can’t perform that action at this time.
0 commit comments