Skip to content

Releases: octet-stream/form-data-encoder

1.1.0

27 Jul 17:01
Compare
Choose a tag to compare

Update

  • Get rid of nanoid in favour of crypto.randomBytes and focus on Node.js support only, because browsers can handle encoding themselves.

All changes: v1.0.1...v1.1.0

1.0.1

19 Jun 17:18
Compare
Choose a tag to compare

Update

  • Add escaping for CR, LF and " symbols in name and filename params;
  • Add an alternative example for Blob as conversion target;

All changes: v1.0.0...v1.0.1

1.0.0 - First stable release

11 Jun 17:42
Compare
Choose a tag to compare

Add

  • Expose isFileLike and isFormDataLike

Update

  • Documentation improvements
  • Loosen tests in isFormDataLike
  • Make private members actually private

All changes: v0.5.1...v1.0.0

0.5.1

15 May 18:58
Compare
Choose a tag to compare

Update

  • Fix for 3rd example in documentation: node-fetch currently does not support async iterables, so the example is not valid when the encoder targeting fetch-blob@3

All changes: v0.5.0...v0.5.1

0.5.0

15 May 18:49
Compare
Choose a tag to compare

Update

  • Lowercase default boundary string lead characters so it can be used when targeting the Encoder output to Blob:
import {FormData} from "formdata-polyfill/esm-min.js"
import {blobFrom} from "fetch-blob/from.js"
import {Encoder} from "form-data-encoder"

import Blob from "fetch-blob"
import fetch from "node-fetch"

async function toBlob(form) {
  const encoder = new Encoder(form) // No need to use custom boundary with lowercased alphabetical characters anymore
  const chunks = []

  for await (const chunk of encoder) {
    chunks.push(chunk)
  }

  return new Blob(chunks, {type: encoder.contentType})
}

const fd = new FormData()

fd.set("name", "John Doe")
fd.set("avatar", await blobFrom("path/to/an/avatar.png"), "avatar.png")

const options = {
  method: "post",
  body: await toBlob(fd)
}

await fetch("https://httpbin.org/post", options)

All changes: v0.4.0...v0.5.0

0.4.0

15 May 17:46
Compare
Choose a tag to compare

Update

  • Put TextEncoder usage to the instance-wide scope and move CRLF and DASHES to Encoder constructor
  • Behaviour compatibility fix: Do not try to guess Content-Type header for a File from its name property

Remove

  • Because of behaviour changes in the Encoder, the mime-types package was removed from dependencies

All changes: v0.3.0...v0.4.0

0.3.0

14 May 23:11
Compare
Choose a tag to compare

Update

  • Improve Encoder#headers API (make it an actual property)
  • Improve documentation and add more usage examples

All changes: v0.2.0...v0.3.0

0.2.0

13 May 21:17
Compare
Choose a tag to compare

Update

  • Documentation improvements
  • Replace Buffer with Uint8Array + TextEncoder
  • The Encoder#encode() method now yields Uint8Array instead of Buffer

All changes: v0.1.0...v0.2.0

0.1.0

12 May 22:36
Compare
Choose a tag to compare

Initial release

See readme.md for documentation