Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@house-of-angular/nestjs-streaming

Package Overview
Dependencies
Maintainers
6
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@house-of-angular/nestjs-streaming

Useful providers that allows working with streaming like responses

latest
Source
npmnpm
Version
0.3.0
Version published
Weekly downloads
4
300%
Maintainers
6
Weekly downloads
 
Created
Source

@house-of-angular/nestjs-streaming

version downloads

Useful providers that allows working with streaming like responses

Installation

npm install --save-dev @house-of-angular/nestjs-streaming

Available modules

  • DownloadExpressModule
  • StreamingExpressModule
  • UrlStreamerNativeModule

Usage

Download nad Streaming modules provide services that pass your stream as a response and set headers appropriate for each case.

UrlStreamer provide a service that allows you to easily get the url as a stream.

Example

app.controller.ts

import { Controller, Get, Inject, Res } from '@nestjs/common';
import {
  ResponseStreamerFactory,
  responseStreamerFactoryToken,
  StreamingType
} from '@house-of-angular/nestjs-streaming';

@Controller()
export class AppController {
  constructor(
    @Inject(responseStreamerFactoryToken)
    private responseStreamerFactory: ResponseStreamerFactory
  ) {}

  @Get('')
  async downloadFile(@Res() res): Promise<void> {
    return this.responseStreamerFactory(StreamingType.Full, res).stream({
      contentType: 'application/png',
      size: 1024,
      stream: () => fs.createReadStream('file.png')
    });
  }
}

app.module.ts

import { Module } from '@nestjs/common';
import { DownloadExpressModule } from '@house-of-angular/nestjs-streaming';
import { AppController } from './app.controller';

@Module({
  imports: [DownloadExpressModule],
  controllers: [AppController]
})
export class AppModule {}

Keywords

nestjs

FAQs

Package last updated on 06 Oct 2023

Did you know?

Socket

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