Github user janpio commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/746#discussion_r143309683 --- Diff: www/_posts/2017-10-02-from-filetransfer-to-xhr2.md --- @@ -0,0 +1,175 @@ +--- +layout: post +author: + name: Fil Maj + url: https://twitter.com/filmaj +title: "Transition off of cordova-plugin-file-transfer" +categories: blog +tags: plugins +--- + +Early on in Cordova's existence, the [file-transfer plugin](https://github.com/apache/cordova-plugin-file-transfer) +was created to solve the [problem of downloading binary files](https://issues.apache.org/jira/browse/CB-22). +At the time, there weren't great options for solving this using standards-compliant +web APIs. The web took a twisty path to get to a solution (see +[Firefox's `sendAsBinary`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/sendAsBinary) +and the now-defunct [FileSystem API](https://dev.w3.org/2009/dap/file-system/file-dir-sys.html)'s +[BlobBuilder](https://developer.mozilla.org/en-US/docs/Web/API/BlobBuilder), +among others), but today you can use our good friend [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest)'s +newest features, combined with some newer JavaScript types and objects, +[to solve this problem](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data). +This is an exciting moment for Cordova as the dream for this project was always +to eventually reduce the surface area of APIs the project maintains, and instead +see regular web APIs be able to handle these use cases. + +As a result, +[Cordova is sunsetting the file-transfer plugin](https://issues.apache.org/jira/browse/CB-13052). +What does "sunsetting" mean? In summary: + +* No more work will be done on the file-transfer plugin by the Cordova development + community. +* You can continue to use the file-transfer plugin if you wish - it should work + fine as-is for the foreseeable future. +* We highly suggest Cordova users transition to using the + [standards-compliant way of sending and receiving binary data](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data). + +All of us at Apache Cordova don't want to leave y'all hanging, though, so we +thought it'd be a good idea to show you how to use these newer XHR features to do +what file-transfer lets you do, but in a way that will work in any modern web +browser to boot! + +## Requirements + +Based on how deeply you interact with the underlying device filesystem, and on +which platforms, you may still need to rely on the +[Cordova File plugin](https://github.com/apache/cordova-plugin-file). If you +still have references to `requestFileSystem` or `root.fs` in your application's +JavaScript, you will definitely need the File plugin because these are not +standards-compliant APIs. Take note and care! + +## Platform Support + +Binary types in JavaScript, as well as the extended XHR features, are available +on the following Cordova-supported platforms without requiring any additional +plugins: + +* Android 4.4 or newer. +* iOS 10 or newer. +* Windows UWP (8.1, 10 or newer all work). +* Windows Phone 8 or newer. + +As always, check [caniuse.com](https://caniuse.com) for detailed support for the +required bits, like [`Blob`](http://caniuse.com/#feat=blobbuilder), +[Typed Arrays](http://caniuse.com/#feat=typedarrays), and +[extended XHR features](http://caniuse.com/#feat=xhr2). + +## TL;DR + +Don't care about "standards" and all that mumbo jumbo? Just looking to copy-paste --- End diff -- Sounds a bit snarky. Intended?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org