Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite93286e

Browse files
panther7Filip Mösner
and
Filip Mösner
authored
fix: deprecation warning for new Buffer (#1905)
Co-authored-by: Filip Mösner <filip.mosner@firma.seznam.cz>
1 parenteaf9f0a commite93286e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎src/reader.js‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,14 @@ Reader.prototype.bytes = function read_bytes() {
312312
this.pos+=length;
313313
if(Array.isArray(this.buf))// plain array
314314
returnthis.buf.slice(start,end);
315-
returnstart===end// fix for IE 10/Win8 and others' subarray returning array of size 1
316-
?newthis.buf.constructor(0)
317-
:this._slice.call(this.buf,start,end);
315+
316+
if(start===end){// fix for IE 10/Win8 and others' subarray returning array of size 1
317+
varnativeBuffer=util.Buffer;
318+
returnnativeBuffer
319+
?nativeBuffer.alloc(0)
320+
:newthis.buf.constructor(0);
321+
}
322+
returnthis._slice.call(this.buf,start,end);
318323
};
319324

320325
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp