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

0.3.0
latest
Source
npmnpm
Version published
Weekly downloads
0
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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.