cross platform - PCL Save Image File to local File System -
i'm looking way store image files in in local filesystem using pcl storage plugin in core project windows phone, xamarin.android , xamarin.ios. plugin provide methods writing text. nothing bytes. there way save byte arrays?
how this:
ifile file = await filesystem.current.getfilefrompathasync(fs.filepath); byte[] buffer = new byte[100]; using (system.io.stream stream = await file.openasync(fileaccess.readandwrite)) { stream.write(buffer, 0, 100); }
edit: code taken http://pclstorage.codeplex.com/
ifile file = await folder.createfileasync("myfile.abc", creationcollisionoption.replaceexisting);
once you've got ifile object should able use in same way:
ifile file = await folder.createfileasync("myfile.abc", creationcollisionoption.replaceexisting); byte[] buffer = new byte[100]; using (system.io.stream stream = await file.openasync(fileaccess.readandwrite)) { stream.write(buffer, 0, 100); }
Comments
Post a Comment