Skip to content

Commit

Permalink
Emit the native file object (bleenco#304)
Browse files Browse the repository at this point in the history
* Emit the native file object

This will allow client side processing via the FileReader API.

* Update readme with description of new changes.
  • Loading branch information
Matthew D authored and jkuri committed Jul 9, 2017
1 parent 1d8ee5b commit a65c5fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface UploadFile {
export interface UploadOutput {
type: 'addedToQueue' | 'allAddedToQueue' | 'uploading' | 'done' | 'removed' | 'start' | 'cancelled' | 'dragOver' | 'dragOut' | 'drop';
file?: UploadFile;
nativeFile?: File; // native javascript File object, can be used to process uploaded files in other libraries
}

// input events that user can emit to ngx-uploader
Expand Down
3 changes: 2 additions & 1 deletion src/ngx-uploader/classes/ngx-uploader.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface UploadFile {
export interface UploadOutput {
type: 'addedToQueue' | 'allAddedToQueue' | 'uploading' | 'done' | 'removed' | 'start' | 'cancelled' | 'dragOver' | 'dragOut' | 'drop';
file?: UploadFile;
nativeFile?: File;
}

export interface UploadInput {
Expand Down Expand Up @@ -100,7 +101,7 @@ export class NgUploaderService {
lastModifiedDate: file.lastModifiedDate
};

this.serviceEvents.emit({ type: 'addedToQueue', file: uploadFile });
this.serviceEvents.emit({ type: 'addedToQueue', file: uploadFile, nativeFile: file });
return uploadFile;
}));

Expand Down

0 comments on commit a65c5fe

Please sign in to comment.