
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@coolgk/formdata
Advanced tools
A http request form data parser (large file friendly) for 'application/json', 'application/x-www-form-urlencoded' and 'multipart/form-data'. It only parses form data when you ask for it.
a javascript / typescript module
npm install @coolgk/formdata
A http request form data parser (large file friendly) for 'application/json', 'application/x-www-form-urlencoded' and 'multipart/form-data'. It only parses form data when you ask for it.
Report bugs here: https://github.com/coolgk/node-utils/issues
<form method="POST" enctype="multipart/form-data">
<input type="text" name="name">
<input type="text" name="age">
<input type="file" name="photo">
<input type="file" name="photo">
<input type="file" name="id">
</form>
// express middleware
const app = require('express')();
const formdata = require('@coolgk/formdata');
app.use(formdata.express());
app.post('/id-only', async (request, response, next) => {
const post = await request.formdata.getData('id'); // upload 3 files but only parse 1, ignore others
console.log(post);
response.json(post);
// output
// {
// "name": "Tim",
// "age": "33",
// "id": {
// "error": null,
// "fieldname": "id",
// "filename": "test.txt",
// "encoding": "7bit",
// "mimetype": "text/plain",
// "size": 13,
// "path": "/tmp/151605931497716067xZGgxPUdNvoj"
// }
// }
});
app.post('/all-files', async (request, response, next) => {
const post = await request.formdata.getData(['id', 'photo']); // parse all files
console.log(post);
response.json(post);
// output
// {
// "name": "Tim",
// "age": "33",
// "photo": [
// {
// "error": null,
// "fieldname": "photo",
// "filename": "test.png",
// "encoding": "7bit",
// "mimetype": "image/png",
// "size": 604,
// "path": "/tmp/151605931497716067xZGgxPUdNvoj"
// },
// {
// "error": null,
// "fieldname": "photo",
// "filename": "test.svg",
// "encoding": "7bit",
// "mimetype": "image/svg+xml",
// "size": 2484,
// "path": "/tmp/151605931497916067EAUAa3yB4q42"
// }
// ],
// "id": {
// "error": null,
// "fieldname": "id",
// "filename": "test.txt",
// "encoding": "7bit",
// "mimetype": "text/plain",
// "size": 13,
// "path": "/tmp/151605931498016067zqZe6dlhidQ5"
// }
// }
});
app.listen(8888);
const { formData, express, getFormData, FormDataError } = require('@coolgk/formdata');
const http = require('http');
http.createServer(async (request, response) => {
const data = await getFormData(request, { fileFieldNames: ['id', 'photo'] });
// OR
// const formdata = formData(request);
// ... some middelware
// ... in some routes
// const data = formdata.getData(['id', 'photo']);
console.log(data);
response.end(JSON.stringify(data));
// {
// "name": "Tim",
// "age": "33",
// "photo": [
// {
// "error": null,
// "fieldname": "photo",
// "filename": "test.png",
// "encoding": "7bit",
// "mimetype": "image/png",
// "size": 604,
// "path": "/tmp/151605931497716067xZGgxPUdNvoj"
// },
// {
// "error": null,
// "fieldname": "photo",
// "filename": "test.svg",
// "encoding": "7bit",
// "mimetype": "image/svg+xml",
// "size": 2484,
// "path": "/tmp/151605931497916067EAUAa3yB4q42"
// }
// ],
// "id": {
// "error": null,
// "fieldname": "id",
// "filename": "test.txt",
// "encoding": "7bit",
// "mimetype": "text/plain",
// "size": 13,
// "path": "/tmp/151605931498016067zqZe6dlhidQ5"
// }
// }
}).listen(8888);
FAQs
A http request form data parser (large file friendly) for 'application/json', 'application/x-www-form-urlencoded' and 'multipart/form-data'. It only parses form data when you ask for it.
The npm package @coolgk/formdata receives a total of 6 weekly downloads. As such, @coolgk/formdata popularity was classified as not popular.
We found that @coolgk/formdata demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.