diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-06-15 18:55:34 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-06-15 18:55:34 +0300 |
commit | 81095d895291f522957deaabbe8bd2bfc978f073 (patch) | |
tree | 12005a8a086aa1bcc6490d79f3736618c5bd02a5 /docs | |
parent | 612c31a3faf068565104d5d370f6c07e94942989 (diff) |
API: Add file.getBlob() method
Get a W3C `Blob` object which contains the file data.
The file will be fetched from the network with highest priority, and
`callback` will be
called once the file is ready. `callback` must be specified, and will
be called with a an
`Error` (or `null`) and the `Blob` object.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/api.md | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/api.md b/docs/api.md index 4750f02..eca7144 100644 --- a/docs/api.md +++ b/docs/api.md @@ -517,6 +517,14 @@ file.appendTo('#containerElement', function (err, elem) { Like `file.appendTo` but renders directly into given element (or CSS selector). +## `file.getBlob(function callback (err, blob) {})` *(browser only)* + +Get a W3C `Blob` object which contains the file data. + +The file will be fetched from the network with highest priority, and `callback` will be +called once the file is ready. `callback` must be specified, and will be called with a an +`Error` (or `null`) and the `Blob` object. + ## `file.getBlobURL(function callback (err, url) {})` *(browser only)* Get a url which can be used in the browser to refer to the file. @@ -525,6 +533,8 @@ The file will be fetched from the network with highest priority, and `callback` called once the file is ready. `callback` must be specified, and will be called with a an `Error` (or `null`) and the Blob URL (`String`). +This method is useful for creating a file download link, like this: + ```js file.getBlobURL(function (err, url) { if (err) throw err |