MCPcopy Index your code
hub / github.com/ThatGuySam/doesitarm / mapDataToFormat

Function mapDataToFormat

helpers/scanner/file-api.ts:77–88  ·  view source on GitHub ↗
( file: NodeFile, data: NodeBuffer, format: ReadFormat, encoding?: BufferEncoding )

Source from the content-addressed store, hash-verified

75}
76
77function 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
90export class File implements NodeFile {
91 blob?: Blob

Callers 1

mapStreamToEmitterMethod · 0.85

Calls 1

toDataUrlFunction · 0.85

Tested by

no test coverage detected