Skip to content

Instantly share code, notes, and snippets.

View chaman-1's full-sized avatar

chaman chaman-1

View GitHub Profile
@chaman-1
chaman-1 / upload.component.ts
Last active April 19, 2021 18:58
Vimeo video uploader using tus js client
//Filename: upload.component.ts
import { Component, OnInit } from '@angular/core';
import { UploadService } from '../upload.service';
import { map, expand } from 'rxjs/operators';
import { EMPTY } from 'rxjs';
export class uploadFiles {
constructor(public video: File, public path: string, public uploadURI: string) {
this.video = video;
this.path = path;
@chaman-1
chaman-1 / app.component.ts
Last active October 31, 2019 19:16
Compress images in Angular recursively using rxJS
import { Component } from '@angular/core';
import { map, expand } from 'rxjs/operators';
import { EMPTY } from 'rxjs';
import { CompressorService } from './compressor.service';
@Component({
selector: 'app-root',
template: '<input type="file" (change)="process($event)" multiple/>',
styles: ['']
})
@chaman-1
chaman-1 / compress.js
Last active February 12, 2019 16:07
Compress, resize images in JavaScript
/*
<!-- HTML Part -->
<input id="file" type="file" accept="image/*">
<script>
document.getElementById("file").addEventListener("change", function (event) {
compress(event);
});
</script>
*/
@chaman-1
chaman-1 / app.component.ts
Last active January 23, 2019 11:55
How to upload multiple files without starting their upload parallely, I want to implement synchronous upload, when one file gets uploaded the next file starts uploading
file: FileList; //populated on filechange
uploadURI: Array < String >; //populated after filechange
public Tus() {
if (this.file.length > 0 && this.uploadURI.length > 0) {
this.uploadService.tusUpload(this.file, this.uploadURI);
}
} else {
alert('file length error');
}