2021-03-03 11:46:36 +03:00
|
|
|
import { MultipartReader } from "https://deno.land/std@0.88.0/mime/multipart.ts";
|
|
|
|
import { StringReader } from "https://deno.land/std@0.88.0/io/readers.ts";
|
|
|
|
|
|
|
|
// carriage returns added for running on POSIX, not needed if on windows
|
|
|
|
const content = `--------------------------366796e1c748a2fb\r
|
|
|
|
Content-Disposition: form-data; name="payload"\r
|
|
|
|
Content-Type: text/plain\r
|
|
|
|
\r
|
|
|
|
CONTENT\r
|
2022-05-04 17:25:28 +03:00
|
|
|
--------------------------366796e1c748a2fb--`;
|
2021-03-03 11:46:36 +03:00
|
|
|
|
|
|
|
const boundary = "------------------------366796e1c748a2fb";
|
|
|
|
|
|
|
|
console.log(content);
|
|
|
|
|
|
|
|
const stringReader = new StringReader(content);
|
|
|
|
|
|
|
|
const multipartReader = new MultipartReader(stringReader, boundary);
|
2022-05-04 17:25:28 +03:00
|
|
|
const formData = await multipartReader.readForm();
|
2021-03-03 11:46:36 +03:00
|
|
|
for (const entry of formData.entries()) {
|
|
|
|
console.log("entry", entry);
|
|
|
|
}
|
2022-05-04 17:25:28 +03:00
|
|
|
console.log("formdata", formData);
|