Reputation: 5245
I am trying to save an ImageSource to a file. I've followed the instructions in the docs under the image-source section. Here is what I've done:
let imageSource = new ImageSource();
var fileName = "Test.png";
var knownPath = fs.knownFolders.documents();
var folderPath = fs.path.join(knownPath.path, "Pictures");
var folder = fs.Folder.fromPath(folderPath);
var picturePath = fs.path.join(folderPath, fileName);
let saved = imageSource.saveToFile(picturePath,"png");
The problem is that saved
is always false, yet I cannot see why it is not being saved because it appears that saveToFile
does not throw Errors.
Am I doing something wrong?
Upvotes: 0
Views: 455
Reputation: 5245
As @HabibKazemi pointed out in the comments, imageSource needs to have some source. In this specific case I was trying to savetofile outside the promise that populated the imageSources source.
Upvotes: 0