Socket
Socket
Sign inDemoInstall

formstream

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formstream

A multipart/form-data encoded stream, helper for file upload.


Version published
Maintainers
2
Created

What is formstream?

The formstream npm package is used to create multipart/form-data streams, which are useful for uploading files and data via HTTP requests. It simplifies the process of constructing form data streams, making it easier to handle file uploads in Node.js applications.

What are formstream's main functionalities?

Create a form stream

This feature allows you to create a form stream, add fields and files to it, and then generate the stream for use in an HTTP request.

const formstream = require('formstream');
const form = formstream();
form.field('name', 'value');
form.file('file', '/path/to/file');
form.stream();

Add fields to the form

This feature allows you to add text fields to the form stream. Each field is added with a key-value pair.

const form = formstream();
form.field('username', 'john_doe');
form.field('email', 'john@example.com');

Add files to the form

This feature allows you to add files to the form stream. Each file is added with a key and the file path.

const form = formstream();
form.file('profile_picture', '/path/to/profile.jpg');

Generate the form stream

This feature generates the form stream after adding all the fields and files. The generated stream can then be used in an HTTP request.

const form = formstream();
form.field('username', 'john_doe');
form.file('profile_picture', '/path/to/profile.jpg');
const stream = form.stream();

Other packages similar to formstream

Keywords

FAQs

Package last updated on 07 Jun 2024

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