Socket
Socket
Sign inDemoInstall

@99xt/ng2-fileupload

Package Overview
Dependencies
5
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @99xt/ng2-fileupload

Simpler file upload implementation for angular2 apps


Version published
Weekly downloads
7
increased by250%
Maintainers
2
Install size
16.3 kB
Created
Weekly downloads
 

Readme

Source

@99xt/ng2-fileupload

npm (scoped) license

Simpler file upload implementation for angular2 apps.

Installation

To install this library, run:

npm install @99xt/ng2-fileupload --save

Usage

example.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { ExampleComponent } from './example.component';

// Import the library
import { FileUploadModule } from '@99xt/ng2-fileupload';

@NgModule({
  declarations: [
    ExampleComponent
  ],
  imports: [
    BrowserModule,
    FileUploadModule
  ],
  providers: [],
  bootstrap: [ ExampleComponent ]
})
export class ExampleModule { }

example.component.ts

export class ExampleComponent {
  allowedTypes: any;
  allowedSize: number;
  multiple: boolean;

  files: any;
  
  constructor() {
    this.allowedTypes = [ 'text/markdown' ];
    this.allowedSize = 15; // MB
    this.multiple = true;
  }

  onUploadFiles(evt: any) {
    if (evt.error) {
        throw evt.error;
    }

    const files = evt.files;
    // You can run upload script here
  }
}

example.component.html

<file-upload
  [allowedTypes]="allowedTypes"
  [allowedSize]="allowedSize"
  [multiple]="multiple"
  (onUploadFiles)="onUploadFiles($event)"
>
</file-upload>

Contributing Guide

Setting up the development environment

Clone the repository to your workstation

git clone git@github.com:99xt/ng2-fileupload.git

Navigate to the project directory

cd ng2-fileupload

Install and build the library

Generate all *.js, *.d.ts files

npm install
npm run build

You can find the compiled version in the dist/

Create a symlink from the dist directory to the global node_modules

cd dist
npm link

To lint all *.ts files:

$ npm run lint

Run Demo app

cd demo
npm install
npm start

Publish to NPM

Update the version in both package.json and src/package.json;

npm run build
npm publish dist

License

MIT

FAQs

Last updated on 12 Jul 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc