export function saveAs ( uri , filename ) { const link = document . createElement ( 'a' ) ; if ( typeof link . download === 'string' ) { document . body . appendChild ( link ) ; link . download = filename ; link . href = uri ; link . click ( ) ; document . body . removeChild ( link ) ; } else { location . replace ( uri ) ; } } export function saveJson ( json , filename ) { const blob = new Blob ( [ JSON . stringify ( json ) ] , { type : 'application/json' } ) ; const url = URL . createObjectURL ( blob ) ; saveAs ( url , filename ) ; }