add iOS support and generalise API.
iOS implementation adapted from https://github.com/triceam/phonegap-plugins/tree/master/iOS/ExternalFileUtil