Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/servest/vendor/https/deno.land/std/mime/multipart.ts>matchAfterPrefix

🌾A progressive http server for Deno🌾
Latest
function matchAfterPrefix
import { matchAfterPrefix } from "https://deno.land/x/servest@v1.3.4/vendor/https/deno.land/std/mime/multipart.ts";

Checks whether buf should be considered to match the boundary.

The prefix is "--boundary" or "\r\n--boundary" or "\n--boundary", and the caller has verified already that hasPrefix(buf, prefix) is true.

matchAfterPrefix() returns 1 if the buffer does match the boundary, meaning the prefix is followed by a dash, space, tab, cr, nl, or EOF.

It returns -1 if the buffer definitely does NOT match the boundary, meaning the prefix is followed by some other character. For example, "--foobar" does not match "--foo".

It returns 0 more input needs to be read to make the decision, meaning that buf.length and prefix.length are the same.

Parameters

buf: Uint8Array
prefix: Uint8Array
eof: boolean

Returns

-1 | 0 | 1