Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

formdata-node

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formdata-node

Spec-compliant FormData implementation for Node.js

  • 6.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.2M
increased by3.28%
Maintainers
1
Weekly downloads
 
Created

What is formdata-node?

The formdata-node package is a Node.js module that allows you to create, manipulate, and encode multipart/form-data streams. It can be used to submit forms and upload files via HTTP requests in a way that is compatible with browser FormData API.

What are formdata-node's main functionalities?

Creating FormData

This feature allows you to create a new FormData instance and append fields to it, similar to how you would in a browser environment.

const { FormData } = require('formdata-node');
const formData = new FormData();
formData.append('key', 'value');

Appending Files

This feature enables appending files to the FormData instance, which can then be used to upload files to a server.

const { FormData, fileFromPath } = require('formdata-node');
const formData = new FormData();
formData.append('file', fileFromPath('./path/to/file.txt'));

Retrieving FormData Content

This feature allows you to iterate over the entries in the FormData object, enabling you to access the keys and values that have been appended.

const { FormData } = require('formdata-node');
const formData = new FormData();
formData.append('key', 'value');
for (const [key, value] of formData) {
  console.log(key, value);
}

Encoding FormData

This feature is used to encode the FormData into a Blob, which can then be used to send the data over an HTTP request.

const { FormData, formDataToBlob } = require('formdata-node');
const formData = new FormData();
formData.append('key', 'value');
const blob = formDataToBlob(formData);

Other packages similar to formdata-node

Keywords

FAQs

Package last updated on 24 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc