Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
nested-formdata
Advanced tools
This is a JavaScript utility function that converts JavaScript nested objects into FormData. It's beneficial when you need to send your data to the server in multipart/form-data format. This utility is built with TypeScript and Lodash.
This is a JavaScript utility function that converts JavaScript nested objects into FormData. It's beneficial when you need to send your data to the server in multipart/form-data
format. This utility is built with TypeScript and Lodash.
To install this package, use the following command:
npm install nested-formdata
First, import the function into your JavaScript or TypeScript file:
import { objectToFormData } from 'nested-formdata';
You can then use the objectToFormData function to convert an objects or array of objects to FormData:
const data = {
name: 'John Doe',
age: 30,
photo: File // This can be an instance of File Or array of Files
};
const formData = objectToFormData(data);
You can also handle nested objects:
const data = {
name: 'John Doe',
age: 30,
address: {
city: 'New York',
state: 'NY'
array: [1, 2, 3],
image: File,
}
};
const formData = objectToFormData(data);
objectToFormData(obj, form, namespace)
obj
(Object): The object to convert.form
(FormData, optional): Existing FormData to use.namespace
(String, optional): Namespace to prefix keys with.Pull requests are welcome. Please make sure to update tests as appropriate.
This project is licensed under the MIT License.
FAQs
This is a JavaScript utility function that converts JavaScript nested objects into FormData. It's beneficial when you need to send your data to the server in `multipart/form-data` format. This utility is built with TypeScript and Lodash.
The npm package nested-formdata receives a total of 4 weekly downloads. As such, nested-formdata popularity was classified as not popular.
We found that nested-formdata demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.