Skip to content

Releases: mjackson/remix-the-web

node-fetch-server v0.6.1

07 Feb 01:20
Compare
Choose a tag to compare
  • Update typings and docs for http/2 support

node-fetch-server v0.6.0

06 Feb 20:12
Compare
Choose a tag to compare
  • 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

06 Feb 23:47
Compare
Choose a tag to compare
  • Fix regression when using LocalFileStorage together with form-data-parser (see #53)

tar-parser v0.2.2

04 Feb 01:41
Compare
Choose a tag to compare
  • Add Promise<void> to TarEntryHandler return type

multipart-parser v0.8.2

04 Feb 01:58
Compare
Choose a tag to compare
  • Add Promise<void> to MultipartPartHandler return type

file-storage v0.6.0

04 Feb 01:41
Compare
Choose a tag to compare
  • 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 storage
  • includeMetadata: If true, include file metadata in the result
  • limit: The maximum number of files to return
  • prefix: 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

27 Jan 05:54
Compare
Choose a tag to compare
  • Fix bad publish that left a workspace:^ version identifier in package.json

headers v0.10.0

27 Jan 20:01
Compare
Choose a tag to compare

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() and cookie.values() are now getters that return string[] instead of methods that return IterableIterator<string>
  • BREAKING CHANGE: cookie.forEach() calls its callback with (name, value, cookie) instead of (value, name, map)
  • BREAKING CHANGE: cookie.delete(name) returns void instead of boolean
// 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

25 Jan 17:48
Compare
Choose a tag to compare
  • Iterate manually over response bodies in sendResponse instead of using for 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

25 Jan 17:50
Compare
Choose a tag to compare
  • Handle stream errors in lazy-file/fs' writeFile. When there is an error in the stream, call writeStream.end() on the underlying file stream before rejecting the promise.