( file: NodeFile, data: NodeBuffer, format: ReadFormat, encoding?: BufferEncoding )
| 75 | } |
| 76 | |
| 77 | function mapDataToFormat ( file: NodeFile, data: NodeBuffer, format: ReadFormat, encoding?: BufferEncoding ) { |
| 78 | switch ( format ) { |
| 79 | case 'buffer': |
| 80 | return data |
| 81 | case 'binary': |
| 82 | return data.toString( 'binary' ) |
| 83 | case 'dataUrl': |
| 84 | return toDataUrl( data, file.type ) |
| 85 | case 'text': |
| 86 | return data.toString( encoding || 'utf8' ) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | export class File implements NodeFile { |
| 91 | blob?: Blob |
no test coverage detected