Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/std/mime/multipart.ts>scanUntilBoundary

A modern runtime for JavaScript and TypeScript.
Go to Latest
function scanUntilBoundary
import { scanUntilBoundary } from "https://deno.land/x/deno@v0.28.0/std/mime/multipart.ts";

Scans buf to identify how much of it can be safely returned as part of the PartReader body.

Parameters

buf: Uint8Array
  • The buffer to search for boundaries.
dashBoundary: Uint8Array
  • Is "--boundary".
newLineDashBoundary: Uint8Array
  • Is "\r\n--boundary" or "\n--boundary", depending on what mode we are in. The comments below (and the name) assume "\n--boundary", but either is accepted.
total: number
  • The number of bytes read out so far. If total == 0, then a leading "--boundary" is recognized.
eof: boolean
  • Whether buf contains the final bytes in the stream before EOF. If eof is false, more bytes are expected to follow.

Returns

number | Deno.EOF

The number of data bytes from buf that can be returned as part of the PartReader body.