1
1
// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js
2
2
// (MIT licensed)
3
3
4
- const { Readable } = require ( 'stream' ) ;
5
- const { types } = require ( 'util' ) ;
4
+ const { Readable} = require ( 'stream' ) ;
5
+ const { types} = require ( 'util' ) ;
6
6
7
7
/**
8
8
* @type {WeakMap<Blob, { type: string, buffer: Buffer } }
@@ -15,7 +15,7 @@ class Blob {
15
15
* @param {(ArrayBufferLike | ArrayBufferView | Blob | Buffer | string)[] } blobParts
16
16
* @param {{ type?: string } } [options]
17
17
*/
18
- constructor ( blobParts = [ ] , options = { type : '' } ) {
18
+ constructor ( blobParts = [ ] , options = { type : '' } ) {
19
19
const buffers = blobParts . map ( element => {
20
20
if ( Buffer . isBuffer ( element ) ) {
21
21
return element ;
@@ -96,13 +96,13 @@ class Blob {
96
96
97
97
/**
98
98
* The Blob interface's slice() method creates and returns a new Blob object which contains data from a subset of the blob on which it's called.
99
- *
100
- * @param {number } [start]
101
- * @param {number } [end]
99
+ *
100
+ * @param {number } [start]
101
+ * @param {number } [end]
102
102
* @param {string } [contentType]
103
103
*/
104
104
slice ( start , end , contentType ) {
105
- const { size } = this ;
105
+ const { size} = this ;
106
106
107
107
let relativeStart ;
108
108
let relativeEnd ;
@@ -128,17 +128,17 @@ class Blob {
128
128
relativeStart ,
129
129
relativeStart + span
130
130
) ;
131
- const blob = new Blob ( [ ] , { type : contentType } ) ;
131
+ const blob = new Blob ( [ ] , { type : contentType } ) ;
132
132
const _ = wm . get ( blob ) ;
133
133
_ . buffer = slicedBuffer ;
134
134
return blob ;
135
135
}
136
136
}
137
137
138
138
Object . defineProperties ( Blob . prototype , {
139
- size : { enumerable : true } ,
140
- type : { enumerable : true } ,
141
- slice : { enumerable : true }
139
+ size : { enumerable : true } ,
140
+ type : { enumerable : true } ,
141
+ slice : { enumerable : true }
142
142
} ) ;
143
143
144
144
module . exports = Blob ;
0 commit comments