@tinyhttp/res
Advanced tools
Comparing version 1.2.1 to 1.2.3
/// <reference types="node" /> | ||
import { ServerResponse as S } from 'http'; | ||
import { IncomingMessage as I, ServerResponse as S } from 'http'; | ||
import type { SendFileOptions } from '@tinyhttp/send'; | ||
@@ -8,5 +8,5 @@ export declare type DownloadOptions = SendFileOptions & Partial<{ | ||
declare type Callback = (err?: any) => void; | ||
declare type Res = Pick<S, 'setHeader'> & NodeJS.WritableStream; | ||
export declare const download: <Response_1 extends Res = Res>(res: Response_1) => (path: string, filename?: string | Callback, options?: DownloadOptions | Callback, cb?: Callback) => Response_1; | ||
declare type Res = Pick<S, 'setHeader' | 'statusCode' | 'writeHead'> & NodeJS.WritableStream; | ||
export declare const download: <Request_1 extends Pick<I, "headers"> = Pick<I, "headers">, Response_1 extends Res = Res>(req: Request_1, res: Response_1) => (path: string, filename?: string | Callback, options?: DownloadOptions | Callback, cb?: Callback) => Response_1; | ||
export declare const attachment: <Response_1 extends Pick<S, "setHeader" | "getHeader"> = Pick<S, "setHeader" | "getHeader">>(res: Response_1) => (filename?: string) => Response_1; | ||
export {}; |
@@ -175,3 +175,3 @@ import { sendFile } from '@tinyhttp/send'; | ||
const download = (res) => (path, filename, options, cb) => { | ||
const download = (req, res) => (path, filename, options, cb) => { | ||
let done = cb; | ||
@@ -203,3 +203,3 @@ let name = filename; | ||
// send file | ||
return sendFile(res)(opts.root ? path : resolve(path), opts, done || (() => undefined)); | ||
return sendFile(req, res)(opts.root ? path : resolve(path), opts, done || (() => undefined)); | ||
}; | ||
@@ -206,0 +206,0 @@ const attachment = (res) => (filename) => { |
{ | ||
"name": "@tinyhttp/res", | ||
"version": "1.2.1", | ||
"version": "1.2.3", | ||
"type": "module", | ||
@@ -45,3 +45,3 @@ "description": "response extensions for tinyhttp", | ||
"@tinyhttp/req": "1.2.1", | ||
"@tinyhttp/send": "1.2.0", | ||
"@tinyhttp/send": "1.2.1", | ||
"es-mime-types": "^0.0.16", | ||
@@ -48,0 +48,0 @@ "es-vary": "^0.0.8", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23049
101079
+ Added@tinyhttp/send@1.2.1(transitive)
- Removed@tinyhttp/send@1.2.0(transitive)
Updated@tinyhttp/send@1.2.1