File tree Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -319,9 +319,28 @@ module.exports['_stream_writable.js'] = [
319319 , useCorkedRequest
320320 , addConstructors
321321]
322+
322323module . exports [ 'internal/streams/BufferList.js' ] = [
323- safeBufferFix
324+ [
325+ / (?: v a r | c o n s t ) (?: { ) B u f f e r (?: } ) = r e q u i r e \( ' b u f f e r ' \) (?: \. B u f f e r ) ? ; / ,
326+ `
327+ const Buffer = require('safe-buffer').Buffer
328+ const util = require('util')
329+ `
330+ ]
324331 , fixCopyBuffer
332+ , [
333+ / $ / ,
334+ `
335+
336+ if (util && util.inspect.custom) {
337+ module.exports.prototype[util.inspect.custom] = function () {
338+ const obj = util.inspect({ length: this.length });
339+ return \`\${this.constructor.name} \${obj}\`;
340+ }
341+ }
342+ `
343+ ]
325344
326345]
327346module . exports [ 'internal/streams/destroy.js' ] = [
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- /*<replacement>*/
4-
53function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
64
75var Buffer = require ( 'safe-buffer' ) . Buffer ;
8- /*</replacement>*/
6+ var util = require ( 'util' ) ;
97
108function copyBuffer ( src , target , offset ) {
119 src . copy ( target , offset ) ;
@@ -71,4 +69,11 @@ module.exports = function () {
7169 } ;
7270
7371 return BufferList ;
74- } ( ) ;
72+ } ( ) ;
73+
74+ if ( util && util . inspect . custom ) {
75+ module . exports . prototype [ util . inspect . custom ] = function ( ) {
76+ var obj = util . inspect ( { length : this . length } ) ;
77+ return this . constructor . name + ' ' + obj ;
78+ } ;
79+ }
You can’t perform that action at this time.
0 commit comments