rjweb-server
Advanced tools
Comparing version 9.1.3 to 9.1.4
# Changelog | ||
## 9.1.4 | ||
- Add `options.download` and `options.name` to `<HttpRequestContext>.printFile()` | ||
## 9.1.3 | ||
@@ -4,0 +8,0 @@ |
@@ -436,4 +436,4 @@ "use strict"; | ||
this.headers.set('content-length', fileStat.size.toString()); | ||
if (!this.headers.has('content-disposition') && this.headers.get('content-type') === 'application/octet-stream') { | ||
this.headers.set('content-disposition', `attachment; filename="${path.basename(file)}"`); | ||
if (!this.headers.has('content-disposition')) { | ||
this.headers.set('content-disposition', `${options.download ?? this.headers.get('content-type') === 'application/octet-stream' ? 'attachment' : 'inline'}; filename="${options.name ?? path.basename(file)}"`); | ||
} | ||
@@ -440,0 +440,0 @@ } |
{ | ||
"name": "rjweb-server", | ||
"version": "9.1.3", | ||
"version": "9.1.4", | ||
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "./lib/cjs/index.js", |
@@ -408,4 +408,4 @@ import { Status } from "../../types/global"; | ||
this.headers.set('content-length', fileStat.size.toString()); | ||
if (!this.headers.has('content-disposition') && this.headers.get('content-type') === 'application/octet-stream') { | ||
this.headers.set('content-disposition', `attachment; filename="${path.basename(file)}"`); | ||
if (!this.headers.has('content-disposition')) { | ||
this.headers.set('content-disposition', `${options.download ?? this.headers.get('content-type') === 'application/octet-stream' ? 'attachment' : 'inline'}; filename="${options.name ?? path.basename(file)}"`); | ||
} | ||
@@ -412,0 +412,0 @@ } |
{ | ||
"name": "rjweb-server", | ||
"version": "9.1.3", | ||
"version": "9.1.4", | ||
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "./lib/cjs/index.js", |
@@ -276,2 +276,13 @@ /// <reference types="node" /> | ||
/** | ||
* The Name of the File (if not set, the basename of the file will be used) | ||
* | ||
* Only applied if the `content-disposition` header is not set and options.download is true | ||
* @default path.basename(file) | ||
* @since 9.1.4 | ||
*/ name?: string; | ||
/** | ||
* Whether to download the file or display it in the browser | ||
* @default ctr.headers.get('content-type') === 'application/octet-stream' | ||
*/ download?: boolean; | ||
/** | ||
* Whether some Content Type Headers will be added automatically | ||
@@ -278,0 +289,0 @@ * @default true |
{ | ||
"name": "rjweb-server", | ||
"version": "9.1.3", | ||
"version": "9.1.4", | ||
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "./lib/cjs/index.js", |
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
541550
13210