Spec-compliant FormData implementation for Node.js
324a9a5
Thanks @octet-stream! - Drop node-domexception in favour of Node.js' builtins. Consider polyfilling DOMException if you want to run this package in older environment
324a9a5
Thanks @octet-stream! - Bring back CJS support via tsup. You can now import package in both ES and CJS modules
324a9a5
Thanks @octet-stream! - Drop web-streams-polyfill in favour of Node.js' builtins. Consider polyfilling ReadableStream if you want to run this package in older environment
47a3ff8
Thanks @octet-stream! - Add ReadableStream w/o Symbol.asyncIterator support in Blob
0f68880
Thanks @octet-stream! - Add typings tests to make sure FormData, Blob and File compatible with globally available BodyInit type
47a3ff8
Thanks @octet-stream! - Drop Node.js 16. Now minimal required version is 18.0.0
All changes: https://github.com/octet-stream/form-data/compare/v5.0.0...v5.0.1
entries
argument from FormData
constructor.FileFromPath.slice()
method;File.webkitRelatedPath
property (See v4.4.0 release for more info);File
values in FormData.{append,set}()
methods (See v4.4.0 release for more info);File
(See v4.4.0 release for more info);https://github.com/octet-stream/form-data/compare/v4.3.3...v5.0.0
All changes: https://github.com/octet-stream/form-data/compare/v4.4.0...v4.4.1
Backport File.webkitRelativePath
property for better types compatibility with native FormData
Backport improvements for instanceof
checks on File
object: It now will recognize File
-ish objects and Files as File
instance, but not Blob
or Blob
-ish objects:
Old behaviour:
import {Blob, File} from "formdata-node"
const file = new File(["File content"], "file.txt")
const blob = new Blob()
file instanceof Blob // -> true
file instanceof File // -> true
blob instanceof Blob // -> true
blob instanceof File // -> true
const fileLike = {
[Symbol.toStringTag]: "File",
name: "file.txt",
stream() { }
}
const blobLike = {
[Symbol.toStringTag]: "Blob",
stream() { }
}
fileLike instanceof Blob // -> true
fileLike instanceof File // -> true
blobLike instanceof Blob // -> true
blobLike instanceof File // -> true
New behaviour:
import {Blob, File} from "formdata-node"
const file = new File(["File content"], "file.txt")
const blob = new Blob()
file instanceof Blob // -> true
file instanceof File // -> true
blob instanceof Blob // -> true
blob instanceof File // -> false
const fileLike = {
[Symbol.toStringTag]: "File",
name: "file.txt",
stream() { }
}
const blobLike = {
[Symbol.toStringTag]: "Blob",
stream() { }
}
fileLike instanceof Blob // -> true
fileLike instanceof File // -> true
blobLike instanceof Blob // -> true
blobLike instanceof File // -> false
Backport File
values normalization for better alignment with the spec. FormData instances will store Files
added via .set()
and .append()
methods as is.
Old behaviour:
import {FormData, File} from "formdata-node"
const file = new File(["File content"], "file.txt")
const form = new FormData()
form.set("file", file) // will create a new File, then store that new object
form.get("file") === file // -> false
form.set("file", file, "renamed-file.txt") // will also create a new File (with the new name), then store that new object
form.get("file") === file // -> false
New behaviour:
import {FormData, File} from "formdata-node"
const file = new File(["File content"], "file.txt")
const form = new FormData()
form.set("file", file) // will store this File instance as is
form.get("file") === file // -> true
form.set("file", file, "renamed-file.txt") // will create a new File (with the new name), then store that new object
form.get("file") === file // -> false
All changes: https://github.com/octet-stream/form-data/compare/v4.3.3...v4.4.0
fileFromPath
and fileFromPathSync
functions.All changes: https://github.com/octet-stream/form-data/compare/v4.3.1...v4.3.2