Ich habe eine URL, die ein Bild hat. Ich möchte dieses Bild mit Chrome API herunterladen. Ich entwickle eine Chrome App und keine Erweiterung. Kann mir bitte jemand sagen, wo ich falsch liege ??Wie Bild von einer URL in Chrome App mit Chrome-Dateisystem API herunterladen?
Mein Code:
service('fileService', function($window){
this.saveUserInfo = function(theFilePath) {
// filepath is the url passed from controller{
// Get the directory entry stored (if any).
var fileUrl = "";
var config = {
type: 'saveFile',
suggestedName: 'TheBee.png',
accepts:[{extensions: ['png', 'jpg', 'jpeg']}]
};
chrome.fileSystem.chooseEntry(config, function(writableEntry) {
chrome.fileSystem.getWritableEntry(writableEntry, function(entry1) {
entry1.getFile(theFilePath, {create:true}, function(entry2) {
entry2.createWriter(function(writer) {
var blob = new Blob({type: 'image/png'});
writer.write(blob);
});
});
});
});
});
});
Sollte der Blob-Konstruktor nicht zwei Argumente haben? 'neuer Blob ([data], {opts})' – Endless