2017-10-31 15 views
0

s3から画像をダウンロードした後、「Body」の中にたくさんのビットがあります。以前は、このようなビットをbase64にエンコードし、<img>タグで直接表示していました。s3からダウンロードした画像、保存方法

しかし、ファイルシステム(アンドロイド/ iOS)の「本当の」ファイル(.jpg/png)に保存し、html(バックグラウンド)タグへのパスを与えたいと思います。

(それが動作します?)

私はまだ私はBASE64にS3から得たビットの束を変換する必要がありますし、それを保存したり、そこには、より簡単です方法?

答えて

0
You can use the plugin cordova-plugin-file for saving file locally to your filesystem. 

Like this 
var url = url; 
    var targetPath = cordova.file.externalDataDirectory + NAME; 
    //alert(targetPath); 
    var trustHosts = true; 
    var options = {}; 

$cordovaFileTransfer.download(url, targetPath, options, trustHosts) 

I think you can give the local file address to img src.. 
関連する問題