UNPKG

@nestjs/core

Version:

The core of NestJS, a TypeScript framework for Node.js backends: modules, dependency injection and the request pipeline, on Express, Fastify or node:http.

16 lines (15 loc) • 483 B
import { StreamableFile } from '@nestjs/common'; import { isFunction } from '@nestjs/common/internal'; /** * Destroys the stream of a `StreamableFile` that will not be sent. Nothing * else would release what the stream reads from (e.g. an open file). */ export function destroyStreamableFile(value) { if (!(value instanceof StreamableFile)) { return; } const stream = value.getStream(); if (isFunction(stream?.destroy)) { stream.destroy(); } }