npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gigauploader

v1.2.4

Published

An uploader library for the GiGa.GG service

Downloads

13

Readme

gigauploader

GigaUploader is an uploader library, to upload directly into your https://giga.gg space.

Installation

Using npm:

$ npm i --save gigauploader

# WARNING :
# gigaUploader uses webworker so you have to make the rusha.worker.js available
# in your project. For example, you can copy it in your assets folder.

Usage



import { Component } from '@angular/core';
import { Uploader, FileState, Upload, FileNode } from 'gigauploader';

@Component({
  selector: 'app-root',
  template: `
  <h1>Uploader demo</h1>
  <h2>Select a file</h2>
  <div><input id="input-file"
    type="file"
    multiple
    (change)="fileChangeEvent($event)" /></div>

  <h2>Uploads</h2>
  <div>
    <table>
        <tr *ngFor="let up of uploads" >
          <td>{{ up.state }}</td>
          <td>{{ up.progress.percent | number:"1.1-1" }}%</td>
          <td>{{ (up.progress.speed * 1000) / (1024) | number:"1.1-1" }} KB/s</td>
          <td>{{ up.fileSize }}</td>
          <td>{{ up.fileName }}</td>
        </tr>
    </table>
  </div>
  `,
})
export class AppComponent {

  private uploader: Uploader;

  public constructor() {
    this.uploader = new Uploader({
      // Make sure the rusha.worker.js is available at that url
      workerUrl: '/assets/rusha.worker.js',
    });
  }

  public get uploads(): Upload[] {
    return this.uploader.uploads;
  }

  public fileChangeEvent(event: any): void {
    for (let i = 0; i < event.srcElement.files.length; i++) {
      this.addUpload(event.srcElement.files[i]);
    }
  }

  public addUpload(file: File) {
    const upload = this.uploader.add(
      file,
      file.name,
      (sha1: string, fileName: string): Promise<FileState> => {

        //
        // Make the http request to the backend / GiGa
        //

        return this.http.post(/* example: /rest/node */).toPromise()
      }
    );
    const promise = upload.promise.then((filenode: FileNode | null) => {
      if (filenode != null) {
        // the file has been uploaded. Update your state here.
      }
      this.uploader.remove(upload);
      return null;
    });
    return from(promise);
  }


  public abort(up: Upload) {
    this.uploader.remove(up);
  }
}