You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like this hasn't been implemented yet so I did the following:
NSString* base64Data = [data toString];
BOOL success = NO;
success = [[NSFileManager defaultManager] createFileAtPath:filePath contents:[NSData dataFromBase64String:base64Data] attributes:nil];
if (!success) {
NSLog(@"failed to create file at %@", filePath);
}
else {
NSLog(@"file should have successfully been written at %@", filePath);
}
I've tried it with GIFs, JPGs and PNGs and it works.
Also for the record, if you have a dataURI you can use substr to get everything after the ',' and that's the base64 representation of the image. You can also convert an arraybuffer to base64 with javascript's built in atob method. So base64 made sense for this in my case.
The text was updated successfully, but these errors were encountered:
It looks like this hasn't been implemented yet so I did the following:
NSString* base64Data = [data toString];
BOOL success = NO;
success = [[NSFileManager defaultManager] createFileAtPath:filePath contents:[NSData dataFromBase64String:base64Data] attributes:nil];
if (!success) {
NSLog(@"failed to create file at %@", filePath);
}
else {
NSLog(@"file should have successfully been written at %@", filePath);
}
I've tried it with GIFs, JPGs and PNGs and it works.
Also for the record, if you have a dataURI you can use substr to get everything after the ',' and that's the base64 representation of the image. You can also convert an arraybuffer to base64 with javascript's built in atob method. So base64 made sense for this in my case.
The text was updated successfully, but these errors were encountered: