form-data-encoder
Advanced tools
Comparing version 1.0.1 to 1.1.0
/** | ||
* 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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
35585
571
- Removednanoid@3.1.23
- Removednanoid@3.1.23(transitive)