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

form-data-encoder

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

form-data-encoder - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

2

@type/util/createBoundary.d.ts
/**
* Generates a boundary string for FormData encoder.
*/
declare const createBoundary: () => string;
declare const createBoundary: (size: number) => string;
export default createBoundary;

@@ -41,3 +41,3 @@ "use strict";

*/
constructor(form, boundary = createBoundary_1.default()) {
constructor(form, boundary = createBoundary_1.default(8)) {
_Encoder_instances.add(this);

@@ -70,3 +70,3 @@ _Encoder_CRLF.set(this, void 0);

}
this.boundary = boundary;
this.boundary = `form-data-boundary-${boundary}`;
this.contentType = `multipart/form-data; boundary=${this.boundary}`;

@@ -73,0 +73,0 @@ __classPrivateFieldSet(this, _Encoder_encoder, new TextEncoder(), "f");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const nanoid_1 = require("nanoid");
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
const generate = nanoid_1.customAlphabet(alphabet, 16);
const crypto_1 = require("crypto");
/**
* Generates a boundary string for FormData encoder.
*/
const createBoundary = () => `form-data-boundary-${generate()}`;
const createBoundary = (size) => (crypto_1.randomBytes(size).toString("hex"));
exports.default = createBoundary;

@@ -35,3 +35,3 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {

*/
constructor(form, boundary = createBoundary()) {
constructor(form, boundary = createBoundary(8)) {
_Encoder_instances.add(this);

@@ -64,3 +64,3 @@ _Encoder_CRLF.set(this, void 0);

}
this.boundary = boundary;
this.boundary = `form-data-boundary-${boundary}`;
this.contentType = `multipart/form-data; boundary=${this.boundary}`;

@@ -67,0 +67,0 @@ __classPrivateFieldSet(this, _Encoder_encoder, new TextEncoder(), "f");

@@ -1,8 +0,6 @@

import { customAlphabet } from "nanoid";
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
const generate = customAlphabet(alphabet, 16);
import { randomBytes } from "crypto";
/**
* Generates a boundary string for FormData encoder.
*/
const createBoundary = () => `form-data-boundary-${generate()}`;
const createBoundary = (size) => (randomBytes(size).toString("hex"));
export default createBoundary;
{
"name": "form-data-encoder",
"version": "1.0.1",
"version": "1.1.0",
"description": "Encode FormData content into the multipart/form-data format",

@@ -61,6 +61,3 @@ "repository": "octet-stream/form-data-encoder",

"typescript": "4.3.4"
},
"dependencies": {
"nanoid": "3.1.23"
}
}
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