@next-boost/next-boost
Version:
Add a cache layer for next.js SSR pages. Use stale-while-revalidate to boost the performance.
21 lines (20 loc) • 619 B
TypeScript
/// <reference types="node" />
export declare type PagePayload = {
headers: any;
body: Buffer;
};
/**
* Package the headers and body of a page to a binary format.
* The format will be `%NB%` + length of the headers + headers + body.
*
* @param payload The page payload.
* @returns The binary payload.
*/
export declare function encodePayload({ headers, body }: PagePayload): Buffer;
/**
* Read the headers and body of a page from a binary payload.
*
* @param payload The binary payload.
* @returns The page payload.
*/
export declare function decodePayload(payload: Buffer | undefined): PagePayload;