Releases: mjackson/remix-the-web
Releases Β· mjackson/remix-the-web
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.
form-data-parser v0.7.0
- BREAKING CHANGE: Override
parseFormData
signature so the upload handler is always last in the argument list.parserOptions
are now an optional 2nd arg.
import { parseFormData } from '@mjackson/form-data-parser';
// before
await parseFormData(
request,
(fileUpload) => {
// ...
},
{ maxFileSize },
);
// after
await parseFormData(request, { maxFileSize }, (fileUpload) => {
// ...
});
- Upgrade
multipart-parser
to v0.8 to fix an issue where errors would crash the process whenmaxFileSize
was exceeded (see #28) - Add an example of how to use
form-data-parser
together withfile-storage
to handle multipart uploads on Node.js - Expand
FileUploadHandler
interface to support returningBlob
from the upload handler, which is the superclass ofFile
file-storage v0.5.0
- Add
fileStorage.put(key, file)
method as a convenience aroundfileStorage.set(key, file)
+fileStorage.get(key)
, which is a very common pattern when you need immediate access to the file you just put in storage
// before
await fileStorage.set(key, file);
let newFile = await fileStorage.get(key)!;
// after
let newFile = await fileStorage.put(key, file);
tar-parser v0.2.1
- Add support for environments that do not support
ReadableStream.prototype[Symbol.asyncIterator]
(i.e. Safari), see #46
multipart-parser v0.8.0
This release improves error handling and simplifies some of the internals of the parser.
- BREAKING CHANGE: Change
parseMultipartRequest
andparseMultipart
interfaces fromfor await...of
toawait
+ callback API.
import { parseMultipartRequest } from '@mjackson/multipart-parser';
// before
for await (let part of parseMultipartRequest(request)) {
// ...
}
// after
await parseMultipartRequest(request, (part) => {
// ...
});
This change greatly simplifies the implementation of parseMultipartRequest
/parseMultipart
and fixes a subtle bug that did not properly catch parse errors when maxFileSize
was exceeded (see #28).
- Add
MaxHeaderSizeExceededError
andMaxFileSizeExceededError
to make it easier to have finer-grained error handling.
import * as http from 'node:http';
import {
MultipartParseError,
MaxFileSizeExceededError,
parseMultipartRequest,
} from '@mjackson/multipart-parser/node';
const tenMb = 10 * Math.pow(2, 20);
const server = http.createServer(async (req, res) => {
try {
await parseMultipartRequest(req, { maxFileSize: tenMb }, (part) => {
// ...
});
} catch (error) {
if (error instanceof MaxFileSizeExceededError) {
res.writeHead(413);
res.end(error.message);
} else if (error instanceof MultipartParseError) {
res.writeHead(400);
res.end('Invalid multipart request');
} else {
console.error(error);
res.writeHead(500);
res.end('Internal Server Error');
}
}
});
form-data-parser v0.6.0
- Allow upload handlers to run in parallel. Fixes #44
file-storage v0.4.1
- Fix missing types for
file-storage/local
in npm package
file-storage v0.4.0
- Fixes race conditions with concurrent calls to
set
- Shards storage directories for more scalable file systems
tar-parser v0.2.0
- Fixed a bug that hangs the process when trying to read zero-length entries.