Added
- feat: ctx.file now has support for the
download
option, when set it instructs the client browser to download the file using the Content-Disposition header. Take note: As per RFC 6266 we automatically encode the filename when set.
/* Simply set as true to download */
ctx.file('storage/487348932483.pdf', {download: true});
/* Pass a custom file name */
ctx.file('storage/487348932483.pdf', {download: 'myhappy.pdf'});
/**
* Automatically encodes the file name, the below would result in the following Content-Disposition header:
* attachment; filename="Strasse_(draft)*v1.0.pdf"; filename*=UTF-8''Stra%C3%9Fe_%28draft%29%2Av1.0.pdf
*/
ctx.file('storage/487348932483.pdf', {download: 'Straße_(draft)*v1.0.pdf'});
Improved
- misc: Make use of new barrel exports in valkyrie utils
- deps: Upgrade @cloudflare/workers-types to 4.20250508.0
- deps: Upgrade @types/node to 22.15.16
- deps: Upgrade @valkyriestudios/utils to 12.36.0
Breaking
- feat: Signature for
ctx.json
,ctx.text
andctx.html
has changed from(val, status?, cache?:CacheControlOptions)
to(val, opts?:{status?, cache?:CacheControlOptions})
, this bag-of-options approach allows for future options to be added without further polluting the argument space. - feat: Signature for
ctx.file
has changed from(val, cache?:CacheControlOptions)
to(val, opts?:{cache?:CacheControlOptions, download?:boolean|string})
, this bag-of-options approach allows for future options to be added without further polluting the argument space. - feat: Signature for
ctx.redirect
has changed from(to, status?, opts?:TriFrostContextRedirectOptions)
to(to, opts?:{status?, keep_query?:boolean})
, this bag-of-options approach allows for future options to be added without further polluting the argument space. - misc: Renamed runtimes/Node/Types.ts to runtimes/Node/types.ts (alignment)
- misc: Renamed runtimes/UWS/Types.ts to runtimes/UWS/types.ts (alignment)
- misc: Renamed runtimes/Types.ts to runtimes/types.ts (alignment)
Removed
- deps: @valkyriestudios/validator (as no longer in use)