Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Usage

import * as shed from "https://raw.githubusercontent.com/worker-tools/shed/master/index.ts";

§Classes

AbstractHTML abstract
BufferedByteStreamResponse
BufferedHTMLResponse

If for any reason you don't want to use streaming response bodies, you can use this class instead, which will buffer the entire body before releasing it to the network. Note that headers will still be sent immediately.

BufferedResponse

If for any reason you don't want to use streaming response bodies, you can use this class instead, which will buffer the entire body before releasing it to the network. Note that headers will still be sent immediately.

BufferedStreamResponse

If for any reason you don't want to use streaming response bodies, you can use this class instead, which will buffer the entire body before releasing it to the network. Note that headers will still be sent immediately.

ByteStreamRequest
ByteStreamResponse
EffectsList
EncryptedCookieStore

Encrypted Cookie Store

A partial implementation of the Cookie Store API that transparently encrypts and decrypts cookies via AES-GCM.

ExtendablePromise
Fallback
HTML
HTMLResponse

TBD

JSONParseNexus deprecated
JSONParseStream
JSONRequest
JSONResponse
JSONStreamRequest
JSONStreamResponse
JSONStringifyReadable
JSONStringifyStream
ParamsURL

Like URL, but accepts a params argument that is added to the search parameters/query string.

RequestCookieStore

An implementation of the Cookie Store API for request handlers.

ResolvablePromise
SearchParamsURL

Like URL, but accepts a params argument that is added to the search parameters/query string.

SearchURL

Like URL, but accepts a params argument that is added to the search parameters/query string.

SignedCookieStore

Signed Cookie Store

A partial implementation of the Cookie Store API that transparently signs and verifies cookies via the Web Cryptography API.

StreamRequest
StreamResponse
UnsafeHTML
WorkerRouter

§Variables

accepted
ALLOW_CREDENTIALS
ALLOW_HEADERS
ALLOW_METHODS
ALLOW_ORIGIN
alreadyReported
anyCORS

A CORS middleware that gives clients exactly the permissions they ask for, unless constrained by the definitions in options.

badGateway
badRequest
basics
BINARY

Standard MIME type for binary data

bodyParser
caching
conflict
cors

A CORS middleware that gives clients exactly the permissions they ask for, unless constrained by the definitions in options.

created
defaultBodyParser
encryptedCookies
expectationFailed
failedDependency
flushed
forbidden
FORM
FORM_DATA
found
gatewayTimeout
gone
httpVersionNotSupported
imATeapot
imUsed
insufficientStorage
internalServerError
isAsyncIterable
isIterable
JSON
lengthRequired
locked
loopDetected
methodNotAllowed
misdirectedRequest
movedPermanently
multipleChoices
multiStatus
networkAuthenticationRequired
noContent
nonAuthoritativeInformation
notAcceptable
notExtended
notFound
notImplemented
notModified
ok
ORIGIN
partialContent
payloadTooLarge
paymentRequired
permanentRedirect
plainCookies
preconditionFailed
preconditionRequired
proxyAuthenticationRequired
rangeNotSatisfiable
REQUEST_HEADERS
REQUEST_METHOD
requestHeaderFieldsTooLarge
requestTimeout
resetContent
seeOther
serviceUnavailable
signedCookies
StorageArea
strictCORS

A CORS middleware that only grants the permissions defined via options.

temporaryRedirect
TEXT_HTML
TEXT_PLAIN
tooEarly
tooManyRequests
unauthorized
unavailableForLegalReasons
unprocessableEntity
unsignedCookies
unsupportedMediaType
upgradeRequired
uriTooLong
urlWithParams deprecated
variantAlsoNegotiates
VARY
X_BINARY

Non-standard MIME type for binary data. Sometimes used, so included anyway.

§Functions

accepts

Determines if a request body content type is acceptable to this endpoint.

acceptsEncodings

Determines if a request body content encoding is acceptable to this endpoint.

acceptsLanguages

Determines if a request body content language is acceptable to this endpoint.

combine

Type-enforcing left-to-right function composition function. The first parameter can be a function of any arity, but the remaining parameters must be unary functions. The return type of one function must be compatible with the argument of next function in the argument list (i.e. types flow from left-to-right)

contentEncodings

Performs content negotiation over the content encoding of the response.

contentLanguages

Performs content negotiation over the content language of the response.

contentTypes

Performs content negotiation over the content type of the response.

cookieSession

Cookie session middleware for worker runtimes.

cookiesFrom
createMiddleware

A helper function to create user-defined middleware.

css
executeEffects deprecated
fallback
html
js
jsonFetch
jsonStringifyGenerator deprecated
jsonStringifyStream deprecated
provides

Performs content negotiation over the content type of the response.

providesEncodings

Performs content negotiation over the content encoding of the response.

providesLanguages

Performs content negotiation over the content language of the response.

resolvablePromise deprecated
storageSession

Session middleware for worker runtimes.

unsafeHTML
withMiddleware deprecated

Takes a handler function of the form (x: Request, ctx: Context) => Awaitable<Response> and applies middleware to it.

§Interfaces

Accepted
AcceptedEncoding
AcceptedLanguage
BasicsContext
BodyBinaryContext
BodyFormContext
BodyFormDataContext
BodyJSONContext
BodyParserOptions
BodyTextContext
BodyVendorJSONContext
ContentEncoding
ContentLanguage
ContentType
Context
CookieInit
CookieListItem
CookiesContext
CookieSessionContext
CookieSessionOptions
CookiesOptions
CookieStore

A verbatim TypeScript translation of the interfaces defined in the WICG Cookie Store API working draft.

CookieStoreDeleteOptions
CookieStoreGetOptions
CORSOptions
DeriveOptions
EncryptedCookiesContext
EncryptedCookieStoreOptions
ErrorContext
ExtendableEvent

Extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.

ExtendableEventInit
FetchEvent

This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.

FetchEventInit
FlushedContext
PromiseFulfilledResult
PromiseRejectedResult
RouteContext
SignedCookiesContext
SignedCookieStoreOptions
StorageSessionContext
StorageSessionOptions
UnsignedCookiesContext
URLPatternComponentResult
URLPatternInit
URLPatternResult

§Type Aliases

AllowedKey
Awaitable
BodyContext
BodyParsable
BodyParserDeps
ByteStreamBodyInit
ByteStreamRequestInit
CacheOptions

The Cache-Control HTTP header field holds directives (instructions) — in both requests and responses — that control caching in browsers and shared caches (e.g. Proxies, CDNs).

ContextOf

Helper type to get the context type of a given middleware function.

CookieList
Cookies

An object of the cookies sent with this request. It is for reading convenience only. To make changes, use the associated cookie store instead (provided by the middleware along with this object)

CookieSameSite
ErrorContext deprecated
ErrorHandler
Handler
HTMLContent
HTMLContentStatic
JSONBodyInit
JSONRequestInit
JSONStreamBodyInit
JSONStreamRequestInit
Key
Method
Middleware
Options
PromiseSettledResult
Rec

Any record of unknown values

Reject
Renderable
RequestInitExStatus
ResolvablePromiseInit
Resolve
ResponseEffect
SearchParamsInit
StreamBodyInit
StreamRequestInit
StrictCORSOptions
ToJSON
Unpackable
URLPatternInput