import * as SparkMD5 from 'spark-md5' ; export const bufferToString = ( buffer ) : string => { let binaryString = '' ; const bytes = new Uint8Array ( buffer ) ; for ( let index = 0 ; index < bytes . length ; index ++ ) { binaryString += String . fromCharCode ( bytes [ index ] ) ; } return binaryString ; } ; export const base64MD5FromBuffer = ( buffer ) => window . btoa ( SparkMD5 . ArrayBuffer . hash ( buffer , true ) ) ; export const concatToBuffer = ( ... items ) => new Blob ( items ) ;