How to use the form-data.default function in form-data

To help you get started, we’ve selected a few form-data examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TEIC / romajs / test / setup.js View on Github external
import * as FormData from 'form-data'
import { DOMParser, XMLSerializer } from 'xmldom'
import { JSDOM } from 'jsdom'

global.DOMParser = DOMParser
global.XMLSerializer = XMLSerializer
global.FormData = FormData.default
global.Blob = (strings, encoding) => {return Buffer.from(strings[0], encoding)}
global.usejsdom = (doc) => {
  // Switch document to jsdom
  const jdom = new JSDOM(new XMLSerializer().serializeToString(doc), {contentType: 'text/xml'})
  return jdom.window.document
}

form-data

A library to create readable "multipart/form-data" streams. Can be used to submit forms and file uploads to other web applications.

MIT
Latest version published 2 months ago

Package Health Score

86 / 100
Full package analysis