Frontend/25_02_24/node_modules/@tinyhttp/send/dist/utils.js

15 lines
534 B
JavaScript
Raw Normal View History

2025-02-25 08:55:29 +00:00
import { Stats } from 'node:fs';
import { format, parse } from '@tinyhttp/content-type';
import { eTag } from '@tinyhttp/etag';
export const createETag = (body, encoding) => {
if (body instanceof Stats) {
return eTag(body, { weak: true });
}
return eTag(!Buffer.isBuffer(body) ? Buffer.from(body, encoding) : body, { weak: true });
};
export function setCharset(type, charset) {
const parsed = parse(type);
parsed.parameters.charset = charset;
return format(parsed);
}
//# sourceMappingURL=utils.js.map