Skip to content

Releases: octet-stream/form-data-encoder

2.1.1

06 Sep 10:38
Compare
Choose a tag to compare

Update

  • Fix typings exports in package.json

All changes: v2.1.0...v2.1.1

2.1.0

19 Aug 16:49
Compare
Choose a tag to compare

Update

  • Fix a bug with NaN returned as Content-Length value when FormDataEncoder discovers entries without known length.

All changes: v2.0.1...v2.1.0

2.0.1

23 May 13:24
Compare
Choose a tag to compare

Update

  • Adjust minimal required Node.js version to 14.17

All changes: v2.0.0...v2.0.1

2.0.0

22 May 01:40
Compare
Choose a tag to compare

Breaking

  • Drop CommonJS support. The package is now ESM only;
  • Remove Encoder from exports;
  • Remove deprecated isFormDataLike helper. Use isFormData instead.

Update

  • Minimal required Node.js version is 14.18;
  • Headers in FormDataEncoder.headers property can be accessed in case-insensitive manner. TypeScript users still have correct TS typings, but only for original and lowercased keys (for example Content-Type and content-type);
  • FormData instance will be preserved in array inside of FormDataEncoder instance (previously it held a reference to given FormData instance);
  • Deprecate isFileLike helper. Use isFile instead;
  • Deprecate FormDataEncoder.getContentLength() method. The content-length is now static value, so this method makes no sense. Use FormDataEncoder.contentLength or FormDataEncoder.headers["content-length"] instead.

Add

  • Expose FormDataEncoderHeaders type.

All changes: v1.7.2...v2.0.0

1.7.2

26 Mar 17:29
Compare
Choose a tag to compare

Update

  • Replace negative lookbehind with replacer function in normalizeValue utility, because it of the compatibility issues in Safari (See: #5)

All changes: v1.7.1...v1.7.2

1.7.1

18 Nov 06:31
Compare
Choose a tag to compare

Update

  • Return back isFormDataLike export and mark it deprecated.

All changes: v1.7.0...v1.7.1

1.7.0

04 Nov 07:13
Compare
Choose a tag to compare

Update

  • Use only lowercased alphabetical + numeric characters in createBoundary function to improve compatibility with existent Blob implementation as it's one of the supported targets;
  • In-code documentation improvements;

All changes: v1.6.0...v1.7.0

1.6.0

22 Sep 19:17
Compare
Choose a tag to compare

Add

  • Add options argument for FormDataEncoder constructor;
  • Add support for per part Content-Length header. It turned off by default, because it is not spec-compliant extension - the web clients does not include it. Use enableAdditionalHeaders option to enable this header:
import {Readable} from "stream"

import {FormDataEncoder} from "form-data-encoder"
import {FormData, File} from "formdata-node"

const form = new FormData()
const file = new File(["My hovercraft is full of eels"], "file.txt", {type: "text/plain"})

form.set("field", "Some field")
form.set("file", file)

// You can pass options as the second or third argument
const encoder = new FormDataEncoder(form, {enableAdditionalHeaders: true})

Readable.from(encoder).pipe(process.stdout)

Outputs:

--form-data-boundary-ZrZBNwvvIVAsVl6f
Content-Disposition: form-data; name="field"
Content-Length: 10

Some field
--form-data-boundary-ZrZBNwvvIVAsVl6f
Content-Disposition: form-data; name="file"; filename="file.txt"
Content-Type: text/plain
Content-Length: 29

My hovercraft if full of eels
--form-data-boundary-ZrZBNwvvIVAsVl6f--

To find more information about additional headers per form-data part, see:

All changes: v1.5.4...v1.6.0

1.5.4

21 Sep 22:57
Compare
Choose a tag to compare

Update

  • Documentation improvements;
  • Fixes for FileLike interface.

All changes: v1.5.3...v1.5.4

1.5.3

10 Sep 17:29
Compare
Choose a tag to compare

Update

  • Improvements for typings and documentation.

All changes: v1.5.2...v1.5.3