ng-lz-string
TypeScript icon, indicating that this package has built-in type declarations

1.5.3 • Public • Published

ng-lz-string

An Angular wrapper for lz-string. Built and tested for Angular 4. Should work for > Angular 4.

Installation

To install this library, run:

$ npm install ng-lz-string --save

Usage

Here's how you can use this library in your Angular app:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
 
import { AppComponent } from './app.component';
 
// Import your library
import { LZStringModule, LZStringService } from 'ng-lz-string';
 
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
 
    // Specify the LZ String Module as an import
    LZStringModule
  ],
  providers: [
    // Specify the service in the providers section
    LZStringService
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Once your library is imported in your module, you can use it in your Angular application:

import {LZStringService} from 'ng-lz-string';
 
export class AppComponent implements OnInit {
    constructor(private lz: LZStringService){
    
    }
    
    performCompressionAndDecompression(){
        const compressed = this.lz.compress('This is going to be compressed');
        
        console.log(compressed);
        
        const decompressed = this.lz.decompress(compressed);
        
        console.log(decompressed);
    }
}

Package Sidebar

Install

npm i ng-lz-string

Weekly Downloads

663

Version

1.5.3

License

none

Last publish

Collaborators

  • shailendra.gusain