From 96c0899240f2660f36acb03d32a729ebf4579ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Wed, 6 Apr 2022 13:52:43 +0900 Subject: [PATCH] Buffer from --- form.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/form.js b/form.js index 904e284..02ad332 100644 --- a/form.js +++ b/form.js @@ -7,9 +7,9 @@ var qstr = require( "./querystr.js" ); module.exports = { form_multipart: function( boundary, request, handler ) { - boundary = new Buffer( "--" + boundary ); - var delim = new Buffer( "0D0A0D0A", "hex" ); - var endBuff = new Buffer( "2D2D0D0A", "hex" ); + boundary = Buffer.from( "--" + boundary ); + var delim = Buffer.from( "0D0A0D0A", "hex" ); + var endBuff = Buffer.from( "2D2D0D0A", "hex" ); var st = request.resultStream(); var firstRead = true; @@ -73,7 +73,7 @@ module.exports = { throw new Error( "Invalid form data" ); } - content = content.map( ( v ) => new Buffer( v ) ); + content = content.map( ( v ) => Buffer.from( v ) ); var item; var formData = [];