export default class FileSaver { static save ( blob , fname ) { const url = window . URL . createObjectURL ( blob ) ; const anch = document . createElement ( "a" ) ; anch . href = url ; anch . download = fname ; anch . style . display = "none" ; document . body . appendChild ( anch ) ; anch . click ( ) ; document . body . removeChild ( anch ) ; window . URL . revokeObjectURL ( url ) ; } static saveString ( s , fname ) { const blob = new Blob ( [ s ] , { type : "text/plain;charset=utf-8" } ) ; FileSaver . save ( blob , fname ) ; } static saveBinary ( s , fname ) { const blob = new Blob ( [ new Uint8Array ( s ) ] , { type : "application/octet-stream" , } ) ; FileSaver . save ( blob , fname ) ; } static saveArrayBuffer ( buffer , filename ) { const blob = new Blob ( [ buffer ] , { type : "application/octet-stream" } ) ; FileSaver . save ( blob , filename ) ; } }