import RSVP from 'rsvp'; /** Provides a promise-aware interface for reading files. ```js import { UploadFile, UploadFileReader } from 'ember-file-upload'; let reader = new UploadFileReader(); let file = File.fromDataURL('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAAXNSR0IArs4c6QAAACNJREFUCB1jYICC6dOn/4exwTRMAEYzwBnoOmASMBpuDLIAAIVVFiE0cg0oAAAAAElFTkSuQmCC'); reader.readAsDataURL(file.blob).then((url) => { return url; }, function (err) { console.error(err); }); ``` Promises can be aborted, which will cancel the file upload: ```js let promise = reader.readAsDataURL(file.blob); promise.then((url) => { return url; }, (err) => { console.error(err); }); promise.abort().then(() => { console.error('cancelled reading file'); }); ``` @class UploadFileReader @constructor @param [options] An object with a label to use to mark the promise. */ export default class UploadFileReader { label: string; reader: FileReader; constructor(options?: { label: string; }); /** Reads the file and returns a promise that will return the blob as ArrayBuffer. @method readAsArrayBuffer @return {Promise} A promise that will return the file as an ArrayBuffer */ readAsArrayBuffer(blob: Blob): RSVP.Promise; /** Reads the file and returns a promise that will return the blob as data URL. This is useful for reading images to display as a preview in the browser. @method readAsDataURL @return {Promise} A promise that will return the file as a data URL */ readAsDataURL(blob: Blob): RSVP.Promise; /** Reads the file and returns a promise that will return the blob as binary string. This is useful for reading images or files that are not plain text. @method readAsBinaryString @return {Promise} A promise that will return the file as a binary string */ readAsBinaryString(blob: Blob): RSVP.Promise; /** Reads the file and returns a promise that will return the blob as text. This is useful for reading plain text files. @method readAsText @return {Promise} A promise that will return the file as text */ readAsText(blob: Blob): RSVP.Promise; get cancellablePromise(): RSVP.Promise; }