Releases: mjackson/remix-the-web
node-fetch-server v0.6.1
- Update typings and docs for http/2 support
node-fetch-server v0.6.0
- Add http/2 support
import * as http2 from 'node:http2';
import { createRequestListener } from '@mjackson/node-fetch-server';
let server = http2.createSecureServer(options);
server.on(
'request',
createRequestListener((request) => {
let url = new URL(request.url);
if (url.pathname === '/') {
return new Response('Hello HTTP/2!', {
headers: {
'Content-Type': 'text/plain'
},
});
}
return new Response('Not Found', { status: 404 });
}),
);
file-storage v0.6.1
- Fix regression when using
LocalFileStorage
together withform-data-parser
(see #53)
tar-parser v0.2.2
- Add
Promise<void>
toTarEntryHandler
return type
multipart-parser v0.8.2
- Add
Promise<void>
toMultipartPartHandler
return type
file-storage v0.6.0
- BREAKING CHANGE:
LocalFileStorage
now uses 2 characters for shard directory names instead of 8. - Buffer contents of files stored in
MemoryFileStorage
. - Add
storage.list(options)
for listing files in storage.
The following options
are available:
cursor
: An opaque string that allows you to paginate over the keys in storageincludeMetadata
: Iftrue
, include file metadata in the resultlimit
: The maximum number of files to returnprefix
: Only return keys that start with this string
For example, to list all files under keys that start with user123/
:
let result = await storage.list({ prefix: 'user123/' });
console.log(result.files);
// [
// { key: "user123/..." },
// { key: "user123/..." },
// ...
// ]
result.files
will be an array of { key: string }
objects. To include metadata about each file, use includeMetadata: true
.
let result = await storage.list({ prefix: 'user123/', includeMetadata: true });
console.log(result.files);
// [
// {
// key: "user123/...",
// lastModified: 1737955705270,
// name: "hello.txt",
// size: 16,
// type: "text/plain"
// },
// ...
// ]
Pagination is done via an opaque cursor
property in the list result object. If it is not undefined
, there are more files to list. You can list them by passing the cursor
back in the options
object on the next call. For example, to list all items in storage, you could do something like this:
let result = await storage.list();
console.log(result.files);
while (result.cursor !== undefined) {
result = await storage.list({ cursor: result.cursor });
console.log(result.files);
}
Use the limit
option to limit how many results you get back in the files
array.
multipart-parser v0.8.1
- Fix bad publish that left a
workspace:^
version identifier in package.json
headers v0.10.0
This release contains several improvements to Cookie
that bring it more in line with other headers like Accept
, AcceptEncoding
, and AcceptLanguage
.
- BREAKING CHANGE:
cookie.names()
andcookie.values()
are now getters that returnstring[]
instead of methods that returnIterableIterator<string>
- BREAKING CHANGE:
cookie.forEach()
calls its callback with(name, value, cookie)
instead of(value, name, map)
- BREAKING CHANGE:
cookie.delete(name)
returnsvoid
instead ofboolean
// before
let cookieNames = Array.from(headers.cookie.names());
// after
let cookieNames = headers.cookie.names;
Additionally, this release adds support for the If-None-Match
header. This is useful for conditional GET requests where you want to return a response with content only if the ETag has changed.
import { SuperHeaders } from '@mjackson/headers';
function requestHandler(request: Request): Promise<Response> {
let response = await callDownstreamService(request);
if (request.method === 'GET' && response.headers.has('ETag')) {
let headers = new SuperHeaders(request.headers);
if (headers.ifNoneMatch.matches(response.headers.get('ETag'))) {
return new Response(null, { status: 304 });
}
}
return response;
}
node-fetch-server v0.5.1
- Iterate manually over response bodies in
sendResponse
instead of usingfor await...of
. This seems to avoid an issue where the iterator tries to read from a stream after the lock has been released.
lazy-file v3.3.1
- Handle stream errors in
lazy-file/fs
'writeFile
. When there is an error in the stream, callwriteStream.end()
on the underlying file stream before rejecting the promise.