File tree Expand file tree Collapse file tree 1 file changed +2
-25
lines changed Expand file tree Collapse file tree 1 file changed +2
-25
lines changed Original file line number Diff line number Diff line change @@ -112,32 +112,9 @@ class Blob {
112
112
* @param {string } [contentType]
113
113
*/
114
114
slice ( start , end , contentType ) {
115
- const { size} = this ;
116
-
117
- let relativeStart ;
118
- let relativeEnd ;
119
-
120
- if ( start === undefined ) {
121
- relativeStart = 0 ; //
122
- } else if ( start < 0 ) {
123
- relativeStart = Math . max ( size + start , 0 ) ; //
124
- } else {
125
- relativeStart = Math . min ( start , size ) ;
126
- }
127
-
128
- if ( end === undefined ) {
129
- relativeEnd = size ; //
130
- } else if ( end < 0 ) {
131
- relativeEnd = Math . max ( size + end , 0 ) ; //
132
- } else {
133
- relativeEnd = Math . min ( end , size ) ;
134
- }
135
-
136
- const span = Math . max ( relativeEnd - relativeStart , 0 ) ;
137
- const slicedBuffer = wm
115
+ return new Blob ( [ wm
138
116
. get ( this )
139
- . buffer . slice ( relativeStart , relativeStart + span ) ;
140
- return new Blob ( [ slicedBuffer ] , { type : contentType } ) ;
117
+ . buffer . subarray ( start , end ) ] , { type : contentType } ) ;
141
118
}
142
119
}
143
120
You can’t perform that action at this time.
0 commit comments