Skip to content

Commit

Permalink
All options must be sorted alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
ledyba committed Nov 21, 2024
1 parent 8108c8a commit 9e182ac
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ Enable or disable accepting ranged requests, defaults to true.
Disabling this will not send `Accept-Ranges` and ignore the contents
of the `Range` request header.

##### acceptRanges

Specify maximum chunk size, defaults to send the entire file size.
This will be used when `acceptRanges` is true.

##### cacheControl

Enable or disable setting `Cache-Control` response header, defaults to
Expand Down Expand Up @@ -118,6 +113,11 @@ Provide a max-age in milliseconds for HTTP caching, defaults to 0.
This can also be a string accepted by the
[ms](https://www.npmjs.org/package/ms#readme) module.

##### maxChunkSize

Specify maximum chunk size, defaults to send the entire file size.
This will be used when `acceptRanges` is true.

##### root

Serve files relative to `path`.
Expand Down
8 changes: 4 additions & 4 deletions lib/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ function normalizeOptions (options) {
? Boolean(options.acceptRanges)
: true

const maxChunkSize = options.acceptRanges !== undefined
? Number(options.maxChunkSize)
: null

const cacheControl = options.cacheControl !== undefined
? Boolean(options.cacheControl)
: true
Expand Down Expand Up @@ -134,6 +130,10 @@ function normalizeOptions (options) {

const maxage = normalizeMaxAge(options.maxAge ?? options.maxage)

const maxChunkSize = options.acceptRanges !== undefined
? Number(options.maxChunkSize)
: null

const root = options.root
? resolve(options.root)
: null
Expand Down
10 changes: 5 additions & 5 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ declare namespace send {
*/
acceptRanges?: boolean | undefined;

/**
* Limit max response size when acceptRanges is true, defaults to the entire file size.
*/
maxChunkSize?: number | undefined;

/**
* Enable or disable setting Cache-Control response header, defaults to true.
* Disabling this will ignore the maxAge option.
Expand Down Expand Up @@ -105,6 +100,11 @@ declare namespace send {
*/
maxAge?: string | number | undefined;

/**
* Limit max response size when acceptRanges is true, defaults to the entire file size.
*/
maxChunkSize?: number | undefined;

/**
* Serve files relative to path.
*/
Expand Down

0 comments on commit 9e182ac

Please sign in to comment.