@utilix-tech/sdk 0.46.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +25 -6
- package/dist/{chunk-L6V4W4SU.js → chunk-226EH3ZI.js} +87 -1
- package/dist/{chunk-7PEKYLRB.js → chunk-S3OA5VCX.js} +50 -1
- package/dist/index.cjs +135 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{media-fD8dJ5qR.d.cts → media-BUvwm4wU.d.cts} +27 -2
- package/dist/{media-fD8dJ5qR.d.ts → media-BUvwm4wU.d.ts} +27 -2
- package/dist/{network-Bzm1tjMA.d.cts → network-BG0XDx5W.d.cts} +40 -2
- package/dist/{network-Bzm1tjMA.d.ts → network-BG0XDx5W.d.ts} +40 -2
- package/dist/tools/media.cjs +86 -0
- package/dist/tools/media.d.cts +1 -1
- package/dist/tools/media.d.ts +1 -1
- package/dist/tools/media.js +1 -1
- package/dist/tools/network.cjs +49 -0
- package/dist/tools/network.d.cts +1 -1
- package/dist/tools/network.d.ts +1 -1
- package/dist/tools/network.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Full release notes for all Utilix surfaces (browser tools, REST API, SDKs, MCP server) live at [utilix.tech/changelog](https://utilix.tech/changelog). This file tracks just this package.
|
|
4
4
|
|
|
5
|
+
## 0.47.0
|
|
6
|
+
- Add `buildContentDisposition`, `parseContentDisposition` (content-disposition-builder): build a `Content-Disposition` response header from a disposition type and filename, with an RFC 5987 `filename*` extended parameter for non-ASCII filenames, or parse an existing header into its type, filename, and raw parameters.
|
|
7
|
+
- Add `inspectGifFrames` (gif-frame-inspector): walk a GIF87a/89a file's block structure to report frame count, total animation duration, and loop count, without decoding any LZW-compressed pixel data.
|
|
8
|
+
|
|
5
9
|
## 0.46.0
|
|
6
10
|
- Add `calculateDepreciationSchedule` (depreciation-schedule-calculator): build a year-by-year fixed-asset depreciation schedule from cost, salvage value, and useful life, using straight-line, double-declining-balance, or sum-of-years-digits.
|
|
7
11
|
- Add `analyzeKeywordDensity` (keyword-density-analyzer): count keyword/phrase frequency and density (occurrences per 100 words) across a block of text, with single-word or 2/3-word phrase modes.
|
package/README.md
CHANGED
|
@@ -450,7 +450,8 @@ import { getStatusCode, isValidIp, isValidIpv4, isValidIpv6,
|
|
|
450
450
|
parseHar, validateSitemap, validateRobotsTxt,
|
|
451
451
|
parseUserAgent, buildCacheControl, buildReferrerPolicy, parseIpv6Address, buildLinkHeader, checkSetCookieHeader, analyzeEmailHeaders,
|
|
452
452
|
buildRangeHeader, parseContentRangeHeader, buildVaryHeader, parseVaryHeader, validateManifest,
|
|
453
|
-
buildPermissionsPolicy, parsePermissionsPolicy, buildClientHints, parseClientHintHeaders
|
|
453
|
+
buildPermissionsPolicy, parsePermissionsPolicy, buildClientHints, parseClientHintHeaders,
|
|
454
|
+
buildContentDisposition, parseContentDisposition } from "@utilix-tech/sdk/network";
|
|
454
455
|
|
|
455
456
|
getStatusCode(404);
|
|
456
457
|
// { code: 404, text: "Not Found", description: "...", category: "Client Error" }
|
|
@@ -541,6 +542,16 @@ buildClientHints(["Sec-CH-UA-Platform", "Sec-CH-DPR"]);
|
|
|
541
542
|
// Decode raw Client Hints request-header text into structured values
|
|
542
543
|
parseClientHintHeaders("Sec-CH-UA-Mobile: ?0");
|
|
543
544
|
// { hints: [{ name: "Sec-CH-UA-Mobile", value: false, ... }], unrecognized: [] }
|
|
545
|
+
|
|
546
|
+
// Build a Content-Disposition header for a file download or inline display;
|
|
547
|
+
// non-ASCII filenames get an RFC 5987 filename* parameter alongside an
|
|
548
|
+
// ASCII-sanitized fallback
|
|
549
|
+
buildContentDisposition({ type: "attachment", filename: "résumé.pdf" });
|
|
550
|
+
// { header: 'attachment; filename="r_sum_.pdf"; filename*=UTF-8\'\'r%C3%A9sum%C3%A9.pdf', type: "attachment", filename: "résumé.pdf", filenameEncoded: true }
|
|
551
|
+
|
|
552
|
+
// Parse an existing Content-Disposition header, decoding filename* in preference to filename
|
|
553
|
+
parseContentDisposition('attachment; filename="report.pdf"');
|
|
554
|
+
// { type: "attachment", filename: "report.pdf", filenameIsExtended: false, params: { filename: "report.pdf" } }
|
|
544
555
|
```
|
|
545
556
|
|
|
546
557
|
---
|
|
@@ -700,10 +711,10 @@ analyzeString("café"); // { length: 4, codePoints: [...], ... }
|
|
|
700
711
|
|
|
701
712
|
---
|
|
702
713
|
|
|
703
|
-
### `/media`: Image Header Parsing, EXIF, PDF Metadata & Page Dimensions, WAV, ID3, ICO, FLAC &
|
|
714
|
+
### `/media`: Image Header Parsing, EXIF, PDF Metadata & Page Dimensions, WAV, ID3, ICO, FLAC, Video & GIF Metadata
|
|
704
715
|
|
|
705
716
|
```ts
|
|
706
|
-
import { readImageInfo, readExifData, readPdfMetadata, readPdfPageDimensions, readWavInfo, readId3Tags, readIcoInfo, readFlacInfo, readVideoInfo } from "@utilix-tech/sdk/media";
|
|
717
|
+
import { readImageInfo, readExifData, readPdfMetadata, readPdfPageDimensions, readWavInfo, readId3Tags, readIcoInfo, readFlacInfo, readVideoInfo, inspectGifFrames } from "@utilix-tech/sdk/media";
|
|
707
718
|
|
|
708
719
|
// Reads format, dimensions, bit depth, and alpha channel straight from
|
|
709
720
|
// file bytes: no decoding, no canvas, no image library.
|
|
@@ -761,9 +772,17 @@ readFlacInfo(new Uint8Array(flacBytes));
|
|
|
761
772
|
const videoBytes = await fs.promises.readFile("clip.mp4");
|
|
762
773
|
readVideoInfo(new Uint8Array(videoBytes));
|
|
763
774
|
// { format: "mp4", durationSeconds: 12.5, width: 1920, height: 1080, videoCodec: "avc1", audioCodec: "mp4a", ... }
|
|
775
|
+
|
|
776
|
+
// Walks a GIF87a/89a file's block structure (image descriptors, graphic
|
|
777
|
+
// control extensions, the NETSCAPE2.0 application extension) to report
|
|
778
|
+
// frame count, total animation duration, and loop count, without decoding
|
|
779
|
+
// any LZW-compressed pixel data.
|
|
780
|
+
const gifBytes = await fs.promises.readFile("animation.gif");
|
|
781
|
+
inspectGifFrames(new Uint8Array(gifBytes));
|
|
782
|
+
// { version: "89a", width: 480, height: 270, frameCount: 24, animated: true, loopCount: 0, totalDurationMs: 2400, ... }
|
|
764
783
|
```
|
|
765
784
|
|
|
766
|
-
`readImageInfo` supports PNG, JPEG, GIF, WebP, and BMP. `readExifData` supports JPEG only. `readWavInfo` supports the canonical RIFF/WAVE container only. `readId3Tags` decodes ID3v2.3/2.4 and ID3v1/1.1 only (ID3v2.2 is detected but not decoded). `readIcoInfo` reads .ico icon files only and rejects .cur cursor files. `readFlacInfo` reads the native FLAC container only, not FLAC-in-Ogg. `readVideoInfo` supports MP4 (ISO BMFF) and WebM (EBML/Matroska) containers only.
|
|
785
|
+
`readImageInfo` supports PNG, JPEG, GIF, WebP, and BMP. `readExifData` supports JPEG only. `readWavInfo` supports the canonical RIFF/WAVE container only. `readId3Tags` decodes ID3v2.3/2.4 and ID3v1/1.1 only (ID3v2.2 is detected but not decoded). `readIcoInfo` reads .ico icon files only and rejects .cur cursor files. `readFlacInfo` reads the native FLAC container only, not FLAC-in-Ogg. `readVideoInfo` supports MP4 (ISO BMFF) and WebM (EBML/Matroska) containers only. `inspectGifFrames` reads the GIF87a/89a block structure only; it never decodes pixel data.
|
|
767
786
|
|
|
768
787
|
---
|
|
769
788
|
|
|
@@ -779,14 +798,14 @@ readVideoInfo(new Uint8Array(videoBytes));
|
|
|
779
798
|
| `@utilix-tech/sdk/generators` | UUID v4/v7, ULID, passwords, strength check, entropy estimator, fake data |
|
|
780
799
|
| `@utilix-tech/sdk/time` | Date diff, timezone convert, cron parse, relative time |
|
|
781
800
|
| `@utilix-tech/sdk/units` | Bytes, CSS px/rem, number bases, currency format, credit card/IBAN/barcode/ISBN validation, loan calculator, EMI calculator, compound/simple interest calculators, VAT/sales tax calculator, tip/bill split calculator, break-even point calculator, Rule of 72 calculator, savings goal calculator, ROI calculator, cash denomination/till calculator, payback period calculator, CD maturity calculator |
|
|
782
|
-
| `@utilix-tech/sdk/network` | HTTP status codes, IP validation, country flags, geolocation URLs, HAR file parsing, User-Agent parsing, IPv6 address compress/expand, Permissions-Policy header builder, Client Hints header builder/parser |
|
|
801
|
+
| `@utilix-tech/sdk/network` | HTTP status codes, IP validation, country flags, geolocation URLs, HAR file parsing, User-Agent parsing, IPv6 address compress/expand, Permissions-Policy header builder, Client Hints header builder/parser, Content-Disposition header builder/parser |
|
|
783
802
|
| `@utilix-tech/sdk/api` | cURL build/parse, JWT decode/sign, JWKS parse, CORS headers, CSP header |
|
|
784
803
|
| `@utilix-tech/sdk/code` | SQL format/minify, HTML format/minify, regex tester, GraphQL format, MIME type lookup, GitHub URL parsing, regex ReDoS detector, Conventional Commits linter |
|
|
785
804
|
| `@utilix-tech/sdk/color` | Hex/RGB/HSL/HSV/CMYK convert, palette generation, contrast check |
|
|
786
805
|
| `@utilix-tech/sdk/css` | CSS gradient, box-shadow, border-radius, keyframe animation generators |
|
|
787
806
|
| `@utilix-tech/sdk/misc` | SVG optimize/sanitize, file size format, Unicode inspector |
|
|
788
807
|
| `@utilix-tech/sdk/ai_agent` | Token estimate/trim, chunk text, extract URLs/JSON/keywords, sanitize HTML, flatten/merge JSON, dedupe lines, validate schema, PII/secret/injection detect, vector similarity, few-shot prompt formatter, tool-definition schema linter |
|
|
789
|
-
| `@utilix-tech/sdk/media` | Image format & dimension reading from raw bytes (PNG, JPEG, GIF, WebP, BMP); PDF metadata reading; PDF page dimension/orientation listing; WAV audio info; ID3 tags; ICO favicon inspection; FLAC metadata reading; MP4/WebM video info |
|
|
808
|
+
| `@utilix-tech/sdk/media` | Image format & dimension reading from raw bytes (PNG, JPEG, GIF, WebP, BMP); PDF metadata reading; PDF page dimension/orientation listing; WAV audio info; ID3 tags; ICO favicon inspection; FLAC metadata reading; MP4/WebM video info; GIF frame/loop inspection |
|
|
790
809
|
|
|
791
810
|
---
|
|
792
811
|
|
|
@@ -3,6 +3,7 @@ import { __export } from './chunk-MLKGABMK.js';
|
|
|
3
3
|
// src/tools/media.ts
|
|
4
4
|
var media_exports = {};
|
|
5
5
|
__export(media_exports, {
|
|
6
|
+
inspectGifFrames: () => inspectGifFrames,
|
|
6
7
|
readExifData: () => readExifData,
|
|
7
8
|
readFlacInfo: () => readFlacInfo,
|
|
8
9
|
readIcoInfo: () => readIcoInfo,
|
|
@@ -1220,5 +1221,90 @@ function parseWebm(bytes) {
|
|
|
1220
1221
|
}
|
|
1221
1222
|
return result;
|
|
1222
1223
|
}
|
|
1224
|
+
function skipGifSubBlocks(bytes, offset) {
|
|
1225
|
+
while (offset < bytes.length) {
|
|
1226
|
+
const len = bytes[offset];
|
|
1227
|
+
offset += 1;
|
|
1228
|
+
if (len === 0) break;
|
|
1229
|
+
offset += len;
|
|
1230
|
+
}
|
|
1231
|
+
return offset;
|
|
1232
|
+
}
|
|
1233
|
+
function inspectGifFrames(bytes) {
|
|
1234
|
+
if (bytes.length < 13) return { error: "File too small to be a valid GIF file" };
|
|
1235
|
+
const signature = Buffer.from(bytes.subarray(0, 6)).toString("ascii");
|
|
1236
|
+
if (signature !== "GIF87a" && signature !== "GIF89a") return { error: "Not a valid GIF file (missing GIF87a/GIF89a signature)" };
|
|
1237
|
+
const version = signature.slice(3);
|
|
1238
|
+
const width = readU16LE(bytes, 6);
|
|
1239
|
+
const height = readU16LE(bytes, 8);
|
|
1240
|
+
const packed = bytes[10];
|
|
1241
|
+
const hasGlobalColorTable = (packed & 128) !== 0;
|
|
1242
|
+
const globalColorTableSize = hasGlobalColorTable ? 2 << (packed & 7) : 0;
|
|
1243
|
+
let offset = 13;
|
|
1244
|
+
if (hasGlobalColorTable) offset += globalColorTableSize * 3;
|
|
1245
|
+
let frameCount = 0;
|
|
1246
|
+
let loopCount = null;
|
|
1247
|
+
let totalDurationMs = 0;
|
|
1248
|
+
let hasTransparency = false;
|
|
1249
|
+
let pendingDelay = 0;
|
|
1250
|
+
while (offset < bytes.length) {
|
|
1251
|
+
const blockType = bytes[offset];
|
|
1252
|
+
if (blockType === 59) break;
|
|
1253
|
+
if (blockType === 33) {
|
|
1254
|
+
const label = bytes[offset + 1];
|
|
1255
|
+
offset += 2;
|
|
1256
|
+
if (label === 249) {
|
|
1257
|
+
const subLen = bytes[offset] ?? 0;
|
|
1258
|
+
if (subLen >= 4) {
|
|
1259
|
+
const flags = bytes[offset + 1];
|
|
1260
|
+
pendingDelay = readU16LE(bytes, offset + 2);
|
|
1261
|
+
if (flags & 1) hasTransparency = true;
|
|
1262
|
+
}
|
|
1263
|
+
offset += 1 + subLen;
|
|
1264
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
1265
|
+
} else if (label === 255) {
|
|
1266
|
+
const blockSize = bytes[offset] ?? 0;
|
|
1267
|
+
const appId = Buffer.from(bytes.subarray(offset + 1, offset + 1 + Math.min(blockSize, 11))).toString("ascii");
|
|
1268
|
+
offset += 1 + blockSize;
|
|
1269
|
+
if (appId === "NETSCAPE2.0") {
|
|
1270
|
+
const subLen = bytes[offset] ?? 0;
|
|
1271
|
+
if (subLen >= 3 && bytes[offset + 1] === 1) {
|
|
1272
|
+
loopCount = readU16LE(bytes, offset + 2);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
1276
|
+
} else {
|
|
1277
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
1278
|
+
}
|
|
1279
|
+
} else if (blockType === 44) {
|
|
1280
|
+
if (offset + 10 > bytes.length) return { error: "Truncated image descriptor" };
|
|
1281
|
+
frameCount++;
|
|
1282
|
+
totalDurationMs += pendingDelay * 10;
|
|
1283
|
+
pendingDelay = 0;
|
|
1284
|
+
const packedImg = bytes[offset + 9];
|
|
1285
|
+
const hasLocalColorTable = (packedImg & 128) !== 0;
|
|
1286
|
+
const localColorTableSize = hasLocalColorTable ? 2 << (packedImg & 7) : 0;
|
|
1287
|
+
offset += 10;
|
|
1288
|
+
if (hasLocalColorTable) offset += localColorTableSize * 3;
|
|
1289
|
+
offset += 1;
|
|
1290
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
1291
|
+
} else {
|
|
1292
|
+
break;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
if (frameCount === 0) return { error: "No image data blocks found in this GIF file" };
|
|
1296
|
+
return {
|
|
1297
|
+
version,
|
|
1298
|
+
width,
|
|
1299
|
+
height,
|
|
1300
|
+
frameCount,
|
|
1301
|
+
animated: frameCount > 1,
|
|
1302
|
+
loopCount,
|
|
1303
|
+
totalDurationMs,
|
|
1304
|
+
hasGlobalColorTable,
|
|
1305
|
+
globalColorTableSize,
|
|
1306
|
+
hasTransparency
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1223
1309
|
|
|
1224
|
-
export { media_exports, readExifData, readFlacInfo, readIcoInfo, readId3Tags, readImageInfo, readPdfMetadata, readPdfPageDimensions, readVideoInfo, readWavInfo };
|
|
1310
|
+
export { inspectGifFrames, media_exports, readExifData, readFlacInfo, readIcoInfo, readId3Tags, readImageInfo, readPdfMetadata, readPdfPageDimensions, readVideoInfo, readWavInfo };
|
|
@@ -13,6 +13,7 @@ __export(network_exports, {
|
|
|
13
13
|
analyzeEmailHeaders: () => analyzeEmailHeaders,
|
|
14
14
|
buildCacheControl: () => buildCacheControl,
|
|
15
15
|
buildClientHints: () => buildClientHints,
|
|
16
|
+
buildContentDisposition: () => buildContentDisposition,
|
|
16
17
|
buildDnsQueryUrl: () => buildDnsQueryUrl,
|
|
17
18
|
buildGeoUrl: () => buildGeoUrl,
|
|
18
19
|
buildLinkHeader: () => buildLinkHeader,
|
|
@@ -37,6 +38,7 @@ __export(network_exports, {
|
|
|
37
38
|
isValidIpv4: () => isValidIpv4,
|
|
38
39
|
isValidIpv6: () => isValidIpv6,
|
|
39
40
|
parseClientHintHeaders: () => parseClientHintHeaders,
|
|
41
|
+
parseContentDisposition: () => parseContentDisposition,
|
|
40
42
|
parseContentRangeHeader: () => parseContentRangeHeader,
|
|
41
43
|
parseDnsResponse: () => parseDnsResponse,
|
|
42
44
|
parseGeoResponse: () => parseGeoResponse,
|
|
@@ -2678,5 +2680,52 @@ function parseClientHintHeaders(rawHeaders) {
|
|
|
2678
2680
|
}
|
|
2679
2681
|
return { hints, unrecognized };
|
|
2680
2682
|
}
|
|
2683
|
+
function encodeRFC5987ValueChars(value) {
|
|
2684
|
+
return encodeURIComponent(value).replace(/[!'()*]/g, (c) => "%" + c.charCodeAt(0).toString(16).toUpperCase());
|
|
2685
|
+
}
|
|
2686
|
+
function buildContentDisposition(options = {}) {
|
|
2687
|
+
const type = options.type ?? "attachment";
|
|
2688
|
+
if (type !== "inline" && type !== "attachment") return { error: 'type must be "inline" or "attachment"' };
|
|
2689
|
+
if (!options.filename) return { header: type, type, filenameEncoded: false };
|
|
2690
|
+
const filename = options.filename;
|
|
2691
|
+
if (filename.includes("/") || filename.includes("\\")) return { error: "filename must not contain path separators" };
|
|
2692
|
+
const isAscii = /^[\x20-\x7e]*$/.test(filename);
|
|
2693
|
+
const asciiFallback = filename.replace(/[^\x20-\x7e]/g, "_").replace(/(["\\])/g, "\\$1");
|
|
2694
|
+
let header = `${type}; filename="${asciiFallback}"`;
|
|
2695
|
+
let filenameEncoded = false;
|
|
2696
|
+
if (!isAscii) {
|
|
2697
|
+
header += `; filename*=UTF-8''${encodeRFC5987ValueChars(filename)}`;
|
|
2698
|
+
filenameEncoded = true;
|
|
2699
|
+
}
|
|
2700
|
+
return { header, type, filename, filenameEncoded };
|
|
2701
|
+
}
|
|
2702
|
+
function parseContentDisposition(header) {
|
|
2703
|
+
if (typeof header !== "string" || header.trim() === "") return { error: "header is required" };
|
|
2704
|
+
const parts = header.split(";").map((p) => p.trim()).filter(Boolean);
|
|
2705
|
+
const type = parts[0]?.toLowerCase();
|
|
2706
|
+
if (!type) return { error: "Could not parse a disposition type from the header" };
|
|
2707
|
+
const params = {};
|
|
2708
|
+
for (let i = 1; i < parts.length; i++) {
|
|
2709
|
+
const eq = parts[i].indexOf("=");
|
|
2710
|
+
if (eq === -1) continue;
|
|
2711
|
+
const key = parts[i].slice(0, eq).trim().toLowerCase();
|
|
2712
|
+
let value = parts[i].slice(eq + 1).trim();
|
|
2713
|
+
if (value.startsWith('"') && value.endsWith('"')) value = value.slice(1, -1).replace(/\\(.)/g, "$1");
|
|
2714
|
+
params[key] = value;
|
|
2715
|
+
}
|
|
2716
|
+
let filename = params.filename;
|
|
2717
|
+
let filenameIsExtended = false;
|
|
2718
|
+
if (params["filename*"]) {
|
|
2719
|
+
const match = params["filename*"].match(/^([^']*)'([^']*)'(.*)$/);
|
|
2720
|
+
if (match) {
|
|
2721
|
+
try {
|
|
2722
|
+
filename = decodeURIComponent(match[3]);
|
|
2723
|
+
filenameIsExtended = true;
|
|
2724
|
+
} catch {
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
return { type, filename, filenameIsExtended, params };
|
|
2729
|
+
}
|
|
2681
2730
|
|
|
2682
|
-
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildClientHints, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseClientHintHeaders, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap };
|
|
2731
|
+
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap };
|
package/dist/index.cjs
CHANGED
|
@@ -10193,6 +10193,7 @@ __export(network_exports, {
|
|
|
10193
10193
|
analyzeEmailHeaders: () => analyzeEmailHeaders,
|
|
10194
10194
|
buildCacheControl: () => buildCacheControl,
|
|
10195
10195
|
buildClientHints: () => buildClientHints,
|
|
10196
|
+
buildContentDisposition: () => buildContentDisposition,
|
|
10196
10197
|
buildDnsQueryUrl: () => buildDnsQueryUrl,
|
|
10197
10198
|
buildGeoUrl: () => buildGeoUrl,
|
|
10198
10199
|
buildLinkHeader: () => buildLinkHeader,
|
|
@@ -10217,6 +10218,7 @@ __export(network_exports, {
|
|
|
10217
10218
|
isValidIpv4: () => isValidIpv42,
|
|
10218
10219
|
isValidIpv6: () => isValidIpv6,
|
|
10219
10220
|
parseClientHintHeaders: () => parseClientHintHeaders,
|
|
10221
|
+
parseContentDisposition: () => parseContentDisposition,
|
|
10220
10222
|
parseContentRangeHeader: () => parseContentRangeHeader,
|
|
10221
10223
|
parseDnsResponse: () => parseDnsResponse,
|
|
10222
10224
|
parseGeoResponse: () => parseGeoResponse,
|
|
@@ -12858,6 +12860,53 @@ function parseClientHintHeaders(rawHeaders) {
|
|
|
12858
12860
|
}
|
|
12859
12861
|
return { hints, unrecognized };
|
|
12860
12862
|
}
|
|
12863
|
+
function encodeRFC5987ValueChars(value) {
|
|
12864
|
+
return encodeURIComponent(value).replace(/[!'()*]/g, (c) => "%" + c.charCodeAt(0).toString(16).toUpperCase());
|
|
12865
|
+
}
|
|
12866
|
+
function buildContentDisposition(options = {}) {
|
|
12867
|
+
const type = options.type ?? "attachment";
|
|
12868
|
+
if (type !== "inline" && type !== "attachment") return { error: 'type must be "inline" or "attachment"' };
|
|
12869
|
+
if (!options.filename) return { header: type, type, filenameEncoded: false };
|
|
12870
|
+
const filename = options.filename;
|
|
12871
|
+
if (filename.includes("/") || filename.includes("\\")) return { error: "filename must not contain path separators" };
|
|
12872
|
+
const isAscii = /^[\x20-\x7e]*$/.test(filename);
|
|
12873
|
+
const asciiFallback = filename.replace(/[^\x20-\x7e]/g, "_").replace(/(["\\])/g, "\\$1");
|
|
12874
|
+
let header = `${type}; filename="${asciiFallback}"`;
|
|
12875
|
+
let filenameEncoded = false;
|
|
12876
|
+
if (!isAscii) {
|
|
12877
|
+
header += `; filename*=UTF-8''${encodeRFC5987ValueChars(filename)}`;
|
|
12878
|
+
filenameEncoded = true;
|
|
12879
|
+
}
|
|
12880
|
+
return { header, type, filename, filenameEncoded };
|
|
12881
|
+
}
|
|
12882
|
+
function parseContentDisposition(header) {
|
|
12883
|
+
if (typeof header !== "string" || header.trim() === "") return { error: "header is required" };
|
|
12884
|
+
const parts = header.split(";").map((p) => p.trim()).filter(Boolean);
|
|
12885
|
+
const type = parts[0]?.toLowerCase();
|
|
12886
|
+
if (!type) return { error: "Could not parse a disposition type from the header" };
|
|
12887
|
+
const params = {};
|
|
12888
|
+
for (let i = 1; i < parts.length; i++) {
|
|
12889
|
+
const eq = parts[i].indexOf("=");
|
|
12890
|
+
if (eq === -1) continue;
|
|
12891
|
+
const key = parts[i].slice(0, eq).trim().toLowerCase();
|
|
12892
|
+
let value = parts[i].slice(eq + 1).trim();
|
|
12893
|
+
if (value.startsWith('"') && value.endsWith('"')) value = value.slice(1, -1).replace(/\\(.)/g, "$1");
|
|
12894
|
+
params[key] = value;
|
|
12895
|
+
}
|
|
12896
|
+
let filename = params.filename;
|
|
12897
|
+
let filenameIsExtended = false;
|
|
12898
|
+
if (params["filename*"]) {
|
|
12899
|
+
const match = params["filename*"].match(/^([^']*)'([^']*)'(.*)$/);
|
|
12900
|
+
if (match) {
|
|
12901
|
+
try {
|
|
12902
|
+
filename = decodeURIComponent(match[3]);
|
|
12903
|
+
filenameIsExtended = true;
|
|
12904
|
+
} catch {
|
|
12905
|
+
}
|
|
12906
|
+
}
|
|
12907
|
+
}
|
|
12908
|
+
return { type, filename, filenameIsExtended, params };
|
|
12909
|
+
}
|
|
12861
12910
|
|
|
12862
12911
|
// src/tools/api.ts
|
|
12863
12912
|
var api_exports = {};
|
|
@@ -21806,6 +21855,7 @@ function lintToolSchema(jsonText) {
|
|
|
21806
21855
|
// src/tools/media.ts
|
|
21807
21856
|
var media_exports = {};
|
|
21808
21857
|
__export(media_exports, {
|
|
21858
|
+
inspectGifFrames: () => inspectGifFrames,
|
|
21809
21859
|
readExifData: () => readExifData,
|
|
21810
21860
|
readFlacInfo: () => readFlacInfo,
|
|
21811
21861
|
readIcoInfo: () => readIcoInfo,
|
|
@@ -23023,6 +23073,91 @@ function parseWebm(bytes) {
|
|
|
23023
23073
|
}
|
|
23024
23074
|
return result;
|
|
23025
23075
|
}
|
|
23076
|
+
function skipGifSubBlocks(bytes, offset) {
|
|
23077
|
+
while (offset < bytes.length) {
|
|
23078
|
+
const len = bytes[offset];
|
|
23079
|
+
offset += 1;
|
|
23080
|
+
if (len === 0) break;
|
|
23081
|
+
offset += len;
|
|
23082
|
+
}
|
|
23083
|
+
return offset;
|
|
23084
|
+
}
|
|
23085
|
+
function inspectGifFrames(bytes) {
|
|
23086
|
+
if (bytes.length < 13) return { error: "File too small to be a valid GIF file" };
|
|
23087
|
+
const signature = Buffer.from(bytes.subarray(0, 6)).toString("ascii");
|
|
23088
|
+
if (signature !== "GIF87a" && signature !== "GIF89a") return { error: "Not a valid GIF file (missing GIF87a/GIF89a signature)" };
|
|
23089
|
+
const version2 = signature.slice(3);
|
|
23090
|
+
const width = readU16LE(bytes, 6);
|
|
23091
|
+
const height = readU16LE(bytes, 8);
|
|
23092
|
+
const packed = bytes[10];
|
|
23093
|
+
const hasGlobalColorTable = (packed & 128) !== 0;
|
|
23094
|
+
const globalColorTableSize = hasGlobalColorTable ? 2 << (packed & 7) : 0;
|
|
23095
|
+
let offset = 13;
|
|
23096
|
+
if (hasGlobalColorTable) offset += globalColorTableSize * 3;
|
|
23097
|
+
let frameCount = 0;
|
|
23098
|
+
let loopCount = null;
|
|
23099
|
+
let totalDurationMs = 0;
|
|
23100
|
+
let hasTransparency = false;
|
|
23101
|
+
let pendingDelay = 0;
|
|
23102
|
+
while (offset < bytes.length) {
|
|
23103
|
+
const blockType = bytes[offset];
|
|
23104
|
+
if (blockType === 59) break;
|
|
23105
|
+
if (blockType === 33) {
|
|
23106
|
+
const label = bytes[offset + 1];
|
|
23107
|
+
offset += 2;
|
|
23108
|
+
if (label === 249) {
|
|
23109
|
+
const subLen = bytes[offset] ?? 0;
|
|
23110
|
+
if (subLen >= 4) {
|
|
23111
|
+
const flags = bytes[offset + 1];
|
|
23112
|
+
pendingDelay = readU16LE(bytes, offset + 2);
|
|
23113
|
+
if (flags & 1) hasTransparency = true;
|
|
23114
|
+
}
|
|
23115
|
+
offset += 1 + subLen;
|
|
23116
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
23117
|
+
} else if (label === 255) {
|
|
23118
|
+
const blockSize = bytes[offset] ?? 0;
|
|
23119
|
+
const appId = Buffer.from(bytes.subarray(offset + 1, offset + 1 + Math.min(blockSize, 11))).toString("ascii");
|
|
23120
|
+
offset += 1 + blockSize;
|
|
23121
|
+
if (appId === "NETSCAPE2.0") {
|
|
23122
|
+
const subLen = bytes[offset] ?? 0;
|
|
23123
|
+
if (subLen >= 3 && bytes[offset + 1] === 1) {
|
|
23124
|
+
loopCount = readU16LE(bytes, offset + 2);
|
|
23125
|
+
}
|
|
23126
|
+
}
|
|
23127
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
23128
|
+
} else {
|
|
23129
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
23130
|
+
}
|
|
23131
|
+
} else if (blockType === 44) {
|
|
23132
|
+
if (offset + 10 > bytes.length) return { error: "Truncated image descriptor" };
|
|
23133
|
+
frameCount++;
|
|
23134
|
+
totalDurationMs += pendingDelay * 10;
|
|
23135
|
+
pendingDelay = 0;
|
|
23136
|
+
const packedImg = bytes[offset + 9];
|
|
23137
|
+
const hasLocalColorTable = (packedImg & 128) !== 0;
|
|
23138
|
+
const localColorTableSize = hasLocalColorTable ? 2 << (packedImg & 7) : 0;
|
|
23139
|
+
offset += 10;
|
|
23140
|
+
if (hasLocalColorTable) offset += localColorTableSize * 3;
|
|
23141
|
+
offset += 1;
|
|
23142
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
23143
|
+
} else {
|
|
23144
|
+
break;
|
|
23145
|
+
}
|
|
23146
|
+
}
|
|
23147
|
+
if (frameCount === 0) return { error: "No image data blocks found in this GIF file" };
|
|
23148
|
+
return {
|
|
23149
|
+
version: version2,
|
|
23150
|
+
width,
|
|
23151
|
+
height,
|
|
23152
|
+
frameCount,
|
|
23153
|
+
animated: frameCount > 1,
|
|
23154
|
+
loopCount,
|
|
23155
|
+
totalDurationMs,
|
|
23156
|
+
hasGlobalColorTable,
|
|
23157
|
+
globalColorTableSize,
|
|
23158
|
+
hasTransparency
|
|
23159
|
+
};
|
|
23160
|
+
}
|
|
23026
23161
|
|
|
23027
23162
|
// src/index.ts
|
|
23028
23163
|
var version = "0.1.0";
|
package/dist/index.d.cts
CHANGED
|
@@ -6,14 +6,14 @@ export { d as data } from './data-BKpEOcOX.cjs';
|
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
8
8
|
export { u as units } from './units-DU4Pisfx.cjs';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-BG0XDx5W.cjs';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.cjs';
|
|
11
11
|
export { c as code } from './code-KXoRsHtl.cjs';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.cjs';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.cjs';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.cjs';
|
|
15
15
|
export { a as ai_agent } from './ai_agent-CmrVjvYH.cjs';
|
|
16
|
-
export { m as media } from './media-
|
|
16
|
+
export { m as media } from './media-BUvwm4wU.cjs';
|
|
17
17
|
|
|
18
18
|
declare const version = "0.1.0";
|
|
19
19
|
|
package/dist/index.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ export { d as data } from './data-BKpEOcOX.js';
|
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
8
8
|
export { u as units } from './units-DU4Pisfx.js';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-BG0XDx5W.js';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.js';
|
|
11
11
|
export { c as code } from './code-KXoRsHtl.js';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.js';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.js';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.js';
|
|
15
15
|
export { a as ai_agent } from './ai_agent-CmrVjvYH.js';
|
|
16
|
-
export { m as media } from './media-
|
|
16
|
+
export { m as media } from './media-BUvwm4wU.js';
|
|
17
17
|
|
|
18
18
|
declare const version = "0.1.0";
|
|
19
19
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { media_exports as media } from './chunk-
|
|
1
|
+
export { media_exports as media } from './chunk-226EH3ZI.js';
|
|
2
2
|
export { units_exports as units } from './chunk-KMQHBUYO.js';
|
|
3
|
-
export { network_exports as network } from './chunk-
|
|
3
|
+
export { network_exports as network } from './chunk-S3OA5VCX.js';
|
|
4
4
|
export { api_exports as api } from './chunk-52ZDKSIX.js';
|
|
5
5
|
export { code_exports as code } from './chunk-JL7YTXRB.js';
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
@@ -202,11 +202,35 @@ interface VideoInfoError {
|
|
|
202
202
|
* only the moov box (MP4) or Segment/Info/Tracks elements (WebM) are read.
|
|
203
203
|
*/
|
|
204
204
|
declare function readVideoInfo(bytes: Uint8Array): VideoInfo | VideoInfoError;
|
|
205
|
+
interface GifInfo {
|
|
206
|
+
version: '87a' | '89a';
|
|
207
|
+
width: number;
|
|
208
|
+
height: number;
|
|
209
|
+
frameCount: number;
|
|
210
|
+
animated: boolean;
|
|
211
|
+
loopCount: number | null;
|
|
212
|
+
totalDurationMs: number;
|
|
213
|
+
hasGlobalColorTable: boolean;
|
|
214
|
+
globalColorTableSize: number;
|
|
215
|
+
hasTransparency: boolean;
|
|
216
|
+
}
|
|
217
|
+
interface GifInfoError {
|
|
218
|
+
error: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Walk a GIF87a/89a file's block structure (image descriptors, graphic
|
|
222
|
+
* control extensions, the NETSCAPE2.0 application extension) to report
|
|
223
|
+
* frame count, total animation duration, and loop count, without decoding
|
|
224
|
+
* any LZW-compressed pixel data.
|
|
225
|
+
*/
|
|
226
|
+
declare function inspectGifFrames(bytes: Uint8Array): GifInfo | GifInfoError;
|
|
205
227
|
|
|
206
228
|
type media_ExifData = ExifData;
|
|
207
229
|
type media_ExifError = ExifError;
|
|
208
230
|
type media_FlacInfo = FlacInfo;
|
|
209
231
|
type media_FlacInfoError = FlacInfoError;
|
|
232
|
+
type media_GifInfo = GifInfo;
|
|
233
|
+
type media_GifInfoError = GifInfoError;
|
|
210
234
|
type media_IcoImageEntry = IcoImageEntry;
|
|
211
235
|
type media_IcoInfo = IcoInfo;
|
|
212
236
|
type media_IcoInfoError = IcoInfoError;
|
|
@@ -224,6 +248,7 @@ type media_VideoInfo = VideoInfo;
|
|
|
224
248
|
type media_VideoInfoError = VideoInfoError;
|
|
225
249
|
type media_WavInfo = WavInfo;
|
|
226
250
|
type media_WavInfoError = WavInfoError;
|
|
251
|
+
declare const media_inspectGifFrames: typeof inspectGifFrames;
|
|
227
252
|
declare const media_readExifData: typeof readExifData;
|
|
228
253
|
declare const media_readFlacInfo: typeof readFlacInfo;
|
|
229
254
|
declare const media_readIcoInfo: typeof readIcoInfo;
|
|
@@ -234,7 +259,7 @@ declare const media_readPdfPageDimensions: typeof readPdfPageDimensions;
|
|
|
234
259
|
declare const media_readVideoInfo: typeof readVideoInfo;
|
|
235
260
|
declare const media_readWavInfo: typeof readWavInfo;
|
|
236
261
|
declare namespace media {
|
|
237
|
-
export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_FlacInfo as FlacInfo, type media_FlacInfoError as FlacInfoError, type media_IcoImageEntry as IcoImageEntry, type media_IcoInfo as IcoInfo, type media_IcoInfoError as IcoInfoError, type media_Id3Tags as Id3Tags, type media_Id3TagsError as Id3TagsError, type media_ImageFormat as ImageFormat, type media_ImageInfo as ImageInfo, type media_ImageInfoError as ImageInfoError, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, type media_PdfPageDimension as PdfPageDimension, type media_PdfPageDimensionsResult as PdfPageDimensionsResult, type media_PdfPageOrientation as PdfPageOrientation, type media_VideoInfo as VideoInfo, type media_VideoInfoError as VideoInfoError, type media_WavInfo as WavInfo, type media_WavInfoError as WavInfoError, media_readExifData as readExifData, media_readFlacInfo as readFlacInfo, media_readIcoInfo as readIcoInfo, media_readId3Tags as readId3Tags, media_readImageInfo as readImageInfo, media_readPdfMetadata as readPdfMetadata, media_readPdfPageDimensions as readPdfPageDimensions, media_readVideoInfo as readVideoInfo, media_readWavInfo as readWavInfo };
|
|
262
|
+
export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_FlacInfo as FlacInfo, type media_FlacInfoError as FlacInfoError, type media_GifInfo as GifInfo, type media_GifInfoError as GifInfoError, type media_IcoImageEntry as IcoImageEntry, type media_IcoInfo as IcoInfo, type media_IcoInfoError as IcoInfoError, type media_Id3Tags as Id3Tags, type media_Id3TagsError as Id3TagsError, type media_ImageFormat as ImageFormat, type media_ImageInfo as ImageInfo, type media_ImageInfoError as ImageInfoError, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, type media_PdfPageDimension as PdfPageDimension, type media_PdfPageDimensionsResult as PdfPageDimensionsResult, type media_PdfPageOrientation as PdfPageOrientation, type media_VideoInfo as VideoInfo, type media_VideoInfoError as VideoInfoError, type media_WavInfo as WavInfo, type media_WavInfoError as WavInfoError, media_inspectGifFrames as inspectGifFrames, media_readExifData as readExifData, media_readFlacInfo as readFlacInfo, media_readIcoInfo as readIcoInfo, media_readId3Tags as readId3Tags, media_readImageInfo as readImageInfo, media_readPdfMetadata as readPdfMetadata, media_readPdfPageDimensions as readPdfPageDimensions, media_readVideoInfo as readVideoInfo, media_readWavInfo as readWavInfo };
|
|
238
263
|
}
|
|
239
264
|
|
|
240
|
-
export { type ExifData as E, type FlacInfo as F, type IcoImageEntry as I, type PdfMetadata as P, type VideoInfo as V, type WavInfo as W, type ExifError as a, type FlacInfoError as b, type
|
|
265
|
+
export { readWavInfo as A, type ExifData as E, type FlacInfo as F, type GifInfo as G, type IcoImageEntry as I, type PdfMetadata as P, type VideoInfo as V, type WavInfo as W, type ExifError as a, type FlacInfoError as b, type GifInfoError as c, type IcoInfo as d, type IcoInfoError as e, type Id3Tags as f, type Id3TagsError as g, type ImageFormat as h, type ImageInfo as i, type ImageInfoError as j, type PdfMetadataError as k, type PdfPageDimension as l, media as m, type PdfPageDimensionsResult as n, type PdfPageOrientation as o, type VideoInfoError as p, type WavInfoError as q, inspectGifFrames as r, readExifData as s, readFlacInfo as t, readIcoInfo as u, readId3Tags as v, readImageInfo as w, readPdfMetadata as x, readPdfPageDimensions as y, readVideoInfo as z };
|
|
@@ -202,11 +202,35 @@ interface VideoInfoError {
|
|
|
202
202
|
* only the moov box (MP4) or Segment/Info/Tracks elements (WebM) are read.
|
|
203
203
|
*/
|
|
204
204
|
declare function readVideoInfo(bytes: Uint8Array): VideoInfo | VideoInfoError;
|
|
205
|
+
interface GifInfo {
|
|
206
|
+
version: '87a' | '89a';
|
|
207
|
+
width: number;
|
|
208
|
+
height: number;
|
|
209
|
+
frameCount: number;
|
|
210
|
+
animated: boolean;
|
|
211
|
+
loopCount: number | null;
|
|
212
|
+
totalDurationMs: number;
|
|
213
|
+
hasGlobalColorTable: boolean;
|
|
214
|
+
globalColorTableSize: number;
|
|
215
|
+
hasTransparency: boolean;
|
|
216
|
+
}
|
|
217
|
+
interface GifInfoError {
|
|
218
|
+
error: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Walk a GIF87a/89a file's block structure (image descriptors, graphic
|
|
222
|
+
* control extensions, the NETSCAPE2.0 application extension) to report
|
|
223
|
+
* frame count, total animation duration, and loop count, without decoding
|
|
224
|
+
* any LZW-compressed pixel data.
|
|
225
|
+
*/
|
|
226
|
+
declare function inspectGifFrames(bytes: Uint8Array): GifInfo | GifInfoError;
|
|
205
227
|
|
|
206
228
|
type media_ExifData = ExifData;
|
|
207
229
|
type media_ExifError = ExifError;
|
|
208
230
|
type media_FlacInfo = FlacInfo;
|
|
209
231
|
type media_FlacInfoError = FlacInfoError;
|
|
232
|
+
type media_GifInfo = GifInfo;
|
|
233
|
+
type media_GifInfoError = GifInfoError;
|
|
210
234
|
type media_IcoImageEntry = IcoImageEntry;
|
|
211
235
|
type media_IcoInfo = IcoInfo;
|
|
212
236
|
type media_IcoInfoError = IcoInfoError;
|
|
@@ -224,6 +248,7 @@ type media_VideoInfo = VideoInfo;
|
|
|
224
248
|
type media_VideoInfoError = VideoInfoError;
|
|
225
249
|
type media_WavInfo = WavInfo;
|
|
226
250
|
type media_WavInfoError = WavInfoError;
|
|
251
|
+
declare const media_inspectGifFrames: typeof inspectGifFrames;
|
|
227
252
|
declare const media_readExifData: typeof readExifData;
|
|
228
253
|
declare const media_readFlacInfo: typeof readFlacInfo;
|
|
229
254
|
declare const media_readIcoInfo: typeof readIcoInfo;
|
|
@@ -234,7 +259,7 @@ declare const media_readPdfPageDimensions: typeof readPdfPageDimensions;
|
|
|
234
259
|
declare const media_readVideoInfo: typeof readVideoInfo;
|
|
235
260
|
declare const media_readWavInfo: typeof readWavInfo;
|
|
236
261
|
declare namespace media {
|
|
237
|
-
export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_FlacInfo as FlacInfo, type media_FlacInfoError as FlacInfoError, type media_IcoImageEntry as IcoImageEntry, type media_IcoInfo as IcoInfo, type media_IcoInfoError as IcoInfoError, type media_Id3Tags as Id3Tags, type media_Id3TagsError as Id3TagsError, type media_ImageFormat as ImageFormat, type media_ImageInfo as ImageInfo, type media_ImageInfoError as ImageInfoError, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, type media_PdfPageDimension as PdfPageDimension, type media_PdfPageDimensionsResult as PdfPageDimensionsResult, type media_PdfPageOrientation as PdfPageOrientation, type media_VideoInfo as VideoInfo, type media_VideoInfoError as VideoInfoError, type media_WavInfo as WavInfo, type media_WavInfoError as WavInfoError, media_readExifData as readExifData, media_readFlacInfo as readFlacInfo, media_readIcoInfo as readIcoInfo, media_readId3Tags as readId3Tags, media_readImageInfo as readImageInfo, media_readPdfMetadata as readPdfMetadata, media_readPdfPageDimensions as readPdfPageDimensions, media_readVideoInfo as readVideoInfo, media_readWavInfo as readWavInfo };
|
|
262
|
+
export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_FlacInfo as FlacInfo, type media_FlacInfoError as FlacInfoError, type media_GifInfo as GifInfo, type media_GifInfoError as GifInfoError, type media_IcoImageEntry as IcoImageEntry, type media_IcoInfo as IcoInfo, type media_IcoInfoError as IcoInfoError, type media_Id3Tags as Id3Tags, type media_Id3TagsError as Id3TagsError, type media_ImageFormat as ImageFormat, type media_ImageInfo as ImageInfo, type media_ImageInfoError as ImageInfoError, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, type media_PdfPageDimension as PdfPageDimension, type media_PdfPageDimensionsResult as PdfPageDimensionsResult, type media_PdfPageOrientation as PdfPageOrientation, type media_VideoInfo as VideoInfo, type media_VideoInfoError as VideoInfoError, type media_WavInfo as WavInfo, type media_WavInfoError as WavInfoError, media_inspectGifFrames as inspectGifFrames, media_readExifData as readExifData, media_readFlacInfo as readFlacInfo, media_readIcoInfo as readIcoInfo, media_readId3Tags as readId3Tags, media_readImageInfo as readImageInfo, media_readPdfMetadata as readPdfMetadata, media_readPdfPageDimensions as readPdfPageDimensions, media_readVideoInfo as readVideoInfo, media_readWavInfo as readWavInfo };
|
|
238
263
|
}
|
|
239
264
|
|
|
240
|
-
export { type ExifData as E, type FlacInfo as F, type IcoImageEntry as I, type PdfMetadata as P, type VideoInfo as V, type WavInfo as W, type ExifError as a, type FlacInfoError as b, type
|
|
265
|
+
export { readWavInfo as A, type ExifData as E, type FlacInfo as F, type GifInfo as G, type IcoImageEntry as I, type PdfMetadata as P, type VideoInfo as V, type WavInfo as W, type ExifError as a, type FlacInfoError as b, type GifInfoError as c, type IcoInfo as d, type IcoInfoError as e, type Id3Tags as f, type Id3TagsError as g, type ImageFormat as h, type ImageInfo as i, type ImageInfoError as j, type PdfMetadataError as k, type PdfPageDimension as l, media as m, type PdfPageDimensionsResult as n, type PdfPageOrientation as o, type VideoInfoError as p, type WavInfoError as q, inspectGifFrames as r, readExifData as s, readFlacInfo as t, readIcoInfo as u, readId3Tags as v, readImageInfo as w, readPdfMetadata as x, readPdfPageDimensions as y, readVideoInfo as z };
|
|
@@ -643,6 +643,39 @@ interface ClientHintsParseResult {
|
|
|
643
643
|
declare function parseClientHintHeaders(rawHeaders: string): ClientHintsParseResult | {
|
|
644
644
|
error: string;
|
|
645
645
|
};
|
|
646
|
+
interface ContentDispositionBuildOptions {
|
|
647
|
+
type?: 'inline' | 'attachment';
|
|
648
|
+
filename?: string;
|
|
649
|
+
}
|
|
650
|
+
interface ContentDispositionBuildResult {
|
|
651
|
+
header: string;
|
|
652
|
+
type: string;
|
|
653
|
+
filename?: string;
|
|
654
|
+
filenameEncoded: boolean;
|
|
655
|
+
}
|
|
656
|
+
interface ContentDispositionParseResult {
|
|
657
|
+
type: string;
|
|
658
|
+
filename?: string;
|
|
659
|
+
filenameIsExtended: boolean;
|
|
660
|
+
params: Record<string, string>;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Build a `Content-Disposition` response-header value for a file download
|
|
664
|
+
* or inline display. A filename containing non-ASCII characters gets an
|
|
665
|
+
* ASCII-sanitized `filename` fallback plus an RFC 5987 `filename*` extended
|
|
666
|
+
* parameter carrying the exact UTF-8 encoded name.
|
|
667
|
+
*/
|
|
668
|
+
declare function buildContentDisposition(options?: ContentDispositionBuildOptions): ContentDispositionBuildResult | {
|
|
669
|
+
error: string;
|
|
670
|
+
};
|
|
671
|
+
/**
|
|
672
|
+
* Parse a `Content-Disposition` header value into its disposition type,
|
|
673
|
+
* filename (decoding an RFC 5987 `filename*` parameter in preference to a
|
|
674
|
+
* plain `filename`, if both are present), and raw parameters.
|
|
675
|
+
*/
|
|
676
|
+
declare function parseContentDisposition(header: string): ContentDispositionParseResult | {
|
|
677
|
+
error: string;
|
|
678
|
+
};
|
|
646
679
|
|
|
647
680
|
type network_AuthResultEntry = AuthResultEntry;
|
|
648
681
|
type network_BuildRangeHeaderOptions = BuildRangeHeaderOptions;
|
|
@@ -654,6 +687,9 @@ type network_ClientHintDef = ClientHintDef;
|
|
|
654
687
|
type network_ClientHintValueType = ClientHintValueType;
|
|
655
688
|
type network_ClientHintsBuildResult = ClientHintsBuildResult;
|
|
656
689
|
type network_ClientHintsParseResult = ClientHintsParseResult;
|
|
690
|
+
type network_ContentDispositionBuildOptions = ContentDispositionBuildOptions;
|
|
691
|
+
type network_ContentDispositionBuildResult = ContentDispositionBuildResult;
|
|
692
|
+
type network_ContentDispositionParseResult = ContentDispositionParseResult;
|
|
657
693
|
type network_ContentRangeResult = ContentRangeResult;
|
|
658
694
|
type network_CookieAttributes = CookieAttributes;
|
|
659
695
|
type network_CookieCheckResult = CookieCheckResult;
|
|
@@ -713,6 +749,7 @@ type network_VaryHeaderResult = VaryHeaderResult;
|
|
|
713
749
|
declare const network_analyzeEmailHeaders: typeof analyzeEmailHeaders;
|
|
714
750
|
declare const network_buildCacheControl: typeof buildCacheControl;
|
|
715
751
|
declare const network_buildClientHints: typeof buildClientHints;
|
|
752
|
+
declare const network_buildContentDisposition: typeof buildContentDisposition;
|
|
716
753
|
declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
717
754
|
declare const network_buildGeoUrl: typeof buildGeoUrl;
|
|
718
755
|
declare const network_buildLinkHeader: typeof buildLinkHeader;
|
|
@@ -737,6 +774,7 @@ declare const network_isValidIp: typeof isValidIp;
|
|
|
737
774
|
declare const network_isValidIpv4: typeof isValidIpv4;
|
|
738
775
|
declare const network_isValidIpv6: typeof isValidIpv6;
|
|
739
776
|
declare const network_parseClientHintHeaders: typeof parseClientHintHeaders;
|
|
777
|
+
declare const network_parseContentDisposition: typeof parseContentDisposition;
|
|
740
778
|
declare const network_parseContentRangeHeader: typeof parseContentRangeHeader;
|
|
741
779
|
declare const network_parseDnsResponse: typeof parseDnsResponse;
|
|
742
780
|
declare const network_parseGeoResponse: typeof parseGeoResponse;
|
|
@@ -756,7 +794,7 @@ declare const network_validateManifest: typeof validateManifest;
|
|
|
756
794
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
757
795
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
758
796
|
declare namespace network {
|
|
759
|
-
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
797
|
+
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_ContentDispositionBuildOptions as ContentDispositionBuildOptions, type network_ContentDispositionBuildResult as ContentDispositionBuildResult, type network_ContentDispositionParseResult as ContentDispositionParseResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildContentDisposition as buildContentDisposition, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentDisposition as parseContentDisposition, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
760
798
|
}
|
|
761
799
|
|
|
762
|
-
export { type
|
|
800
|
+
export { type ReferrerPolicyResult as $, type AuthResultEntry as A, type BuildRangeHeaderOptions as B, CLIENT_HINTS as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type LinkHeaderResult as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type LinkRel as J, type ManifestIssue as K, LINK_REL_VALUES as L, type ManifestIconInfo as M, type ManifestValidationResult as N, type ParsedClientHint as O, PERMISSIONS_POLICY_FEATURES as P, type ParsedDnsResult as Q, type ParsedGeoResult as R, type PermissionsPolicyDirective as S, type PermissionsPolicyFeatureInput as T, type PermissionsPolicyResult as U, REFERRER_POLICY_VALUES as V, type RangeEntry as W, type RangeEntryInput as X, type RangeHeaderResult as Y, type ReceivedHop as Z, type ReferrerPolicyEntry as _, type CacheControlDirective as a, type ReferrerPolicyValue as a0, type RobotsGroup as a1, type RobotsIssue as a2, type RobotsRule as a3, type RobotsValidationResult as a4, STATUS_CODES as a5, type SameSiteValue as a6, type SitemapIndexEntry as a7, type SitemapIssue as a8, type SitemapUrlEntry as a9, getStatusCode as aA, isClientError as aB, isServerError as aC, isSuccess as aD, isValidIp as aE, isValidIpv4 as aF, isValidIpv6 as aG, parseClientHintHeaders as aH, parseContentDisposition as aI, parseContentRangeHeader as aJ, parseDnsResponse as aK, parseGeoResponse as aL, parseHar as aM, parseIpv6Address as aN, parsePermissionsPolicy as aO, parseUserAgent as aP, parseVaryHeader as aQ, searchHeaders as aR, searchStatusCodes as aS, statusCodeToText as aT, typeNumberToLabel as aU, validateDomain as aV, validateHeaderName as aW, validateHeaderValue as aX, validateManifest as aY, validateRobotsTxt as aZ, validateSitemap as a_, type SitemapValidationResult as aa, type StatusCode as ab, type UaDeviceType as ac, type UserAgentInfo as ad, type VaryHeaderEntry as ae, type VaryHeaderResult as af, analyzeEmailHeaders as ag, buildCacheControl as ah, buildClientHints as ai, buildContentDisposition as aj, buildDnsQueryUrl as ak, buildGeoUrl as al, buildLinkHeader as am, buildMapUrl as an, buildPermissionsPolicy as ao, buildRangeHeader as ap, buildReferrerPolicy as aq, buildVaryHeader as ar, checkSetCookieHeader as as, countryCodeToFlag as at, formatCoordinates as au, formatTtl as av, getByCategory as aw, getHeader as ax, getHeadersByCategory as ay, getStatusByCategory as az, type CacheControlOptions as b, type CacheControlResult as c, type ClientHintDef as d, type ClientHintValueType as e, type ClientHintsBuildResult as f, type ClientHintsParseResult as g, type ContentDispositionBuildOptions as h, type ContentDispositionBuildResult as i, type ContentDispositionParseResult as j, type ContentRangeResult as k, type CookieAttributes as l, type CookieCheckResult as m, network as n, type DnsRecord as o, type DnsRecordType as p, type DnsResponse as q, type EmailHeaderField as r, type HarEntry as s, type HarParseResult as t, type HarSummary as u, type HeaderCategory as v, type HttpHeader as w, type Ipv6ParseResult as x, type LinkHeaderEntry as y, type LinkHeaderEntryInput as z };
|
|
@@ -643,6 +643,39 @@ interface ClientHintsParseResult {
|
|
|
643
643
|
declare function parseClientHintHeaders(rawHeaders: string): ClientHintsParseResult | {
|
|
644
644
|
error: string;
|
|
645
645
|
};
|
|
646
|
+
interface ContentDispositionBuildOptions {
|
|
647
|
+
type?: 'inline' | 'attachment';
|
|
648
|
+
filename?: string;
|
|
649
|
+
}
|
|
650
|
+
interface ContentDispositionBuildResult {
|
|
651
|
+
header: string;
|
|
652
|
+
type: string;
|
|
653
|
+
filename?: string;
|
|
654
|
+
filenameEncoded: boolean;
|
|
655
|
+
}
|
|
656
|
+
interface ContentDispositionParseResult {
|
|
657
|
+
type: string;
|
|
658
|
+
filename?: string;
|
|
659
|
+
filenameIsExtended: boolean;
|
|
660
|
+
params: Record<string, string>;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Build a `Content-Disposition` response-header value for a file download
|
|
664
|
+
* or inline display. A filename containing non-ASCII characters gets an
|
|
665
|
+
* ASCII-sanitized `filename` fallback plus an RFC 5987 `filename*` extended
|
|
666
|
+
* parameter carrying the exact UTF-8 encoded name.
|
|
667
|
+
*/
|
|
668
|
+
declare function buildContentDisposition(options?: ContentDispositionBuildOptions): ContentDispositionBuildResult | {
|
|
669
|
+
error: string;
|
|
670
|
+
};
|
|
671
|
+
/**
|
|
672
|
+
* Parse a `Content-Disposition` header value into its disposition type,
|
|
673
|
+
* filename (decoding an RFC 5987 `filename*` parameter in preference to a
|
|
674
|
+
* plain `filename`, if both are present), and raw parameters.
|
|
675
|
+
*/
|
|
676
|
+
declare function parseContentDisposition(header: string): ContentDispositionParseResult | {
|
|
677
|
+
error: string;
|
|
678
|
+
};
|
|
646
679
|
|
|
647
680
|
type network_AuthResultEntry = AuthResultEntry;
|
|
648
681
|
type network_BuildRangeHeaderOptions = BuildRangeHeaderOptions;
|
|
@@ -654,6 +687,9 @@ type network_ClientHintDef = ClientHintDef;
|
|
|
654
687
|
type network_ClientHintValueType = ClientHintValueType;
|
|
655
688
|
type network_ClientHintsBuildResult = ClientHintsBuildResult;
|
|
656
689
|
type network_ClientHintsParseResult = ClientHintsParseResult;
|
|
690
|
+
type network_ContentDispositionBuildOptions = ContentDispositionBuildOptions;
|
|
691
|
+
type network_ContentDispositionBuildResult = ContentDispositionBuildResult;
|
|
692
|
+
type network_ContentDispositionParseResult = ContentDispositionParseResult;
|
|
657
693
|
type network_ContentRangeResult = ContentRangeResult;
|
|
658
694
|
type network_CookieAttributes = CookieAttributes;
|
|
659
695
|
type network_CookieCheckResult = CookieCheckResult;
|
|
@@ -713,6 +749,7 @@ type network_VaryHeaderResult = VaryHeaderResult;
|
|
|
713
749
|
declare const network_analyzeEmailHeaders: typeof analyzeEmailHeaders;
|
|
714
750
|
declare const network_buildCacheControl: typeof buildCacheControl;
|
|
715
751
|
declare const network_buildClientHints: typeof buildClientHints;
|
|
752
|
+
declare const network_buildContentDisposition: typeof buildContentDisposition;
|
|
716
753
|
declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
717
754
|
declare const network_buildGeoUrl: typeof buildGeoUrl;
|
|
718
755
|
declare const network_buildLinkHeader: typeof buildLinkHeader;
|
|
@@ -737,6 +774,7 @@ declare const network_isValidIp: typeof isValidIp;
|
|
|
737
774
|
declare const network_isValidIpv4: typeof isValidIpv4;
|
|
738
775
|
declare const network_isValidIpv6: typeof isValidIpv6;
|
|
739
776
|
declare const network_parseClientHintHeaders: typeof parseClientHintHeaders;
|
|
777
|
+
declare const network_parseContentDisposition: typeof parseContentDisposition;
|
|
740
778
|
declare const network_parseContentRangeHeader: typeof parseContentRangeHeader;
|
|
741
779
|
declare const network_parseDnsResponse: typeof parseDnsResponse;
|
|
742
780
|
declare const network_parseGeoResponse: typeof parseGeoResponse;
|
|
@@ -756,7 +794,7 @@ declare const network_validateManifest: typeof validateManifest;
|
|
|
756
794
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
757
795
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
758
796
|
declare namespace network {
|
|
759
|
-
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
797
|
+
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_ContentDispositionBuildOptions as ContentDispositionBuildOptions, type network_ContentDispositionBuildResult as ContentDispositionBuildResult, type network_ContentDispositionParseResult as ContentDispositionParseResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildContentDisposition as buildContentDisposition, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentDisposition as parseContentDisposition, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
760
798
|
}
|
|
761
799
|
|
|
762
|
-
export { type
|
|
800
|
+
export { type ReferrerPolicyResult as $, type AuthResultEntry as A, type BuildRangeHeaderOptions as B, CLIENT_HINTS as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type LinkHeaderResult as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type LinkRel as J, type ManifestIssue as K, LINK_REL_VALUES as L, type ManifestIconInfo as M, type ManifestValidationResult as N, type ParsedClientHint as O, PERMISSIONS_POLICY_FEATURES as P, type ParsedDnsResult as Q, type ParsedGeoResult as R, type PermissionsPolicyDirective as S, type PermissionsPolicyFeatureInput as T, type PermissionsPolicyResult as U, REFERRER_POLICY_VALUES as V, type RangeEntry as W, type RangeEntryInput as X, type RangeHeaderResult as Y, type ReceivedHop as Z, type ReferrerPolicyEntry as _, type CacheControlDirective as a, type ReferrerPolicyValue as a0, type RobotsGroup as a1, type RobotsIssue as a2, type RobotsRule as a3, type RobotsValidationResult as a4, STATUS_CODES as a5, type SameSiteValue as a6, type SitemapIndexEntry as a7, type SitemapIssue as a8, type SitemapUrlEntry as a9, getStatusCode as aA, isClientError as aB, isServerError as aC, isSuccess as aD, isValidIp as aE, isValidIpv4 as aF, isValidIpv6 as aG, parseClientHintHeaders as aH, parseContentDisposition as aI, parseContentRangeHeader as aJ, parseDnsResponse as aK, parseGeoResponse as aL, parseHar as aM, parseIpv6Address as aN, parsePermissionsPolicy as aO, parseUserAgent as aP, parseVaryHeader as aQ, searchHeaders as aR, searchStatusCodes as aS, statusCodeToText as aT, typeNumberToLabel as aU, validateDomain as aV, validateHeaderName as aW, validateHeaderValue as aX, validateManifest as aY, validateRobotsTxt as aZ, validateSitemap as a_, type SitemapValidationResult as aa, type StatusCode as ab, type UaDeviceType as ac, type UserAgentInfo as ad, type VaryHeaderEntry as ae, type VaryHeaderResult as af, analyzeEmailHeaders as ag, buildCacheControl as ah, buildClientHints as ai, buildContentDisposition as aj, buildDnsQueryUrl as ak, buildGeoUrl as al, buildLinkHeader as am, buildMapUrl as an, buildPermissionsPolicy as ao, buildRangeHeader as ap, buildReferrerPolicy as aq, buildVaryHeader as ar, checkSetCookieHeader as as, countryCodeToFlag as at, formatCoordinates as au, formatTtl as av, getByCategory as aw, getHeader as ax, getHeadersByCategory as ay, getStatusByCategory as az, type CacheControlOptions as b, type CacheControlResult as c, type ClientHintDef as d, type ClientHintValueType as e, type ClientHintsBuildResult as f, type ClientHintsParseResult as g, type ContentDispositionBuildOptions as h, type ContentDispositionBuildResult as i, type ContentDispositionParseResult as j, type ContentRangeResult as k, type CookieAttributes as l, type CookieCheckResult as m, network as n, type DnsRecord as o, type DnsRecordType as p, type DnsResponse as q, type EmailHeaderField as r, type HarEntry as s, type HarParseResult as t, type HarSummary as u, type HeaderCategory as v, type HttpHeader as w, type Ipv6ParseResult as x, type LinkHeaderEntry as y, type LinkHeaderEntryInput as z };
|
package/dist/tools/media.cjs
CHANGED
|
@@ -1208,7 +1208,93 @@ function parseWebm(bytes) {
|
|
|
1208
1208
|
}
|
|
1209
1209
|
return result;
|
|
1210
1210
|
}
|
|
1211
|
+
function skipGifSubBlocks(bytes, offset) {
|
|
1212
|
+
while (offset < bytes.length) {
|
|
1213
|
+
const len = bytes[offset];
|
|
1214
|
+
offset += 1;
|
|
1215
|
+
if (len === 0) break;
|
|
1216
|
+
offset += len;
|
|
1217
|
+
}
|
|
1218
|
+
return offset;
|
|
1219
|
+
}
|
|
1220
|
+
function inspectGifFrames(bytes) {
|
|
1221
|
+
if (bytes.length < 13) return { error: "File too small to be a valid GIF file" };
|
|
1222
|
+
const signature = Buffer.from(bytes.subarray(0, 6)).toString("ascii");
|
|
1223
|
+
if (signature !== "GIF87a" && signature !== "GIF89a") return { error: "Not a valid GIF file (missing GIF87a/GIF89a signature)" };
|
|
1224
|
+
const version = signature.slice(3);
|
|
1225
|
+
const width = readU16LE(bytes, 6);
|
|
1226
|
+
const height = readU16LE(bytes, 8);
|
|
1227
|
+
const packed = bytes[10];
|
|
1228
|
+
const hasGlobalColorTable = (packed & 128) !== 0;
|
|
1229
|
+
const globalColorTableSize = hasGlobalColorTable ? 2 << (packed & 7) : 0;
|
|
1230
|
+
let offset = 13;
|
|
1231
|
+
if (hasGlobalColorTable) offset += globalColorTableSize * 3;
|
|
1232
|
+
let frameCount = 0;
|
|
1233
|
+
let loopCount = null;
|
|
1234
|
+
let totalDurationMs = 0;
|
|
1235
|
+
let hasTransparency = false;
|
|
1236
|
+
let pendingDelay = 0;
|
|
1237
|
+
while (offset < bytes.length) {
|
|
1238
|
+
const blockType = bytes[offset];
|
|
1239
|
+
if (blockType === 59) break;
|
|
1240
|
+
if (blockType === 33) {
|
|
1241
|
+
const label = bytes[offset + 1];
|
|
1242
|
+
offset += 2;
|
|
1243
|
+
if (label === 249) {
|
|
1244
|
+
const subLen = bytes[offset] ?? 0;
|
|
1245
|
+
if (subLen >= 4) {
|
|
1246
|
+
const flags = bytes[offset + 1];
|
|
1247
|
+
pendingDelay = readU16LE(bytes, offset + 2);
|
|
1248
|
+
if (flags & 1) hasTransparency = true;
|
|
1249
|
+
}
|
|
1250
|
+
offset += 1 + subLen;
|
|
1251
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
1252
|
+
} else if (label === 255) {
|
|
1253
|
+
const blockSize = bytes[offset] ?? 0;
|
|
1254
|
+
const appId = Buffer.from(bytes.subarray(offset + 1, offset + 1 + Math.min(blockSize, 11))).toString("ascii");
|
|
1255
|
+
offset += 1 + blockSize;
|
|
1256
|
+
if (appId === "NETSCAPE2.0") {
|
|
1257
|
+
const subLen = bytes[offset] ?? 0;
|
|
1258
|
+
if (subLen >= 3 && bytes[offset + 1] === 1) {
|
|
1259
|
+
loopCount = readU16LE(bytes, offset + 2);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
1263
|
+
} else {
|
|
1264
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
1265
|
+
}
|
|
1266
|
+
} else if (blockType === 44) {
|
|
1267
|
+
if (offset + 10 > bytes.length) return { error: "Truncated image descriptor" };
|
|
1268
|
+
frameCount++;
|
|
1269
|
+
totalDurationMs += pendingDelay * 10;
|
|
1270
|
+
pendingDelay = 0;
|
|
1271
|
+
const packedImg = bytes[offset + 9];
|
|
1272
|
+
const hasLocalColorTable = (packedImg & 128) !== 0;
|
|
1273
|
+
const localColorTableSize = hasLocalColorTable ? 2 << (packedImg & 7) : 0;
|
|
1274
|
+
offset += 10;
|
|
1275
|
+
if (hasLocalColorTable) offset += localColorTableSize * 3;
|
|
1276
|
+
offset += 1;
|
|
1277
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
1278
|
+
} else {
|
|
1279
|
+
break;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
if (frameCount === 0) return { error: "No image data blocks found in this GIF file" };
|
|
1283
|
+
return {
|
|
1284
|
+
version,
|
|
1285
|
+
width,
|
|
1286
|
+
height,
|
|
1287
|
+
frameCount,
|
|
1288
|
+
animated: frameCount > 1,
|
|
1289
|
+
loopCount,
|
|
1290
|
+
totalDurationMs,
|
|
1291
|
+
hasGlobalColorTable,
|
|
1292
|
+
globalColorTableSize,
|
|
1293
|
+
hasTransparency
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1211
1296
|
|
|
1297
|
+
exports.inspectGifFrames = inspectGifFrames;
|
|
1212
1298
|
exports.readExifData = readExifData;
|
|
1213
1299
|
exports.readFlacInfo = readFlacInfo;
|
|
1214
1300
|
exports.readIcoInfo = readIcoInfo;
|
package/dist/tools/media.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { E as ExifData, a as ExifError, F as FlacInfo, b as FlacInfoError, I as IcoImageEntry,
|
|
1
|
+
export { E as ExifData, a as ExifError, F as FlacInfo, b as FlacInfoError, G as GifInfo, c as GifInfoError, I as IcoImageEntry, d as IcoInfo, e as IcoInfoError, f as Id3Tags, g as Id3TagsError, h as ImageFormat, i as ImageInfo, j as ImageInfoError, P as PdfMetadata, k as PdfMetadataError, l as PdfPageDimension, n as PdfPageDimensionsResult, o as PdfPageOrientation, V as VideoInfo, p as VideoInfoError, W as WavInfo, q as WavInfoError, r as inspectGifFrames, s as readExifData, t as readFlacInfo, u as readIcoInfo, v as readId3Tags, w as readImageInfo, x as readPdfMetadata, y as readPdfPageDimensions, z as readVideoInfo, A as readWavInfo } from '../media-BUvwm4wU.cjs';
|
package/dist/tools/media.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { E as ExifData, a as ExifError, F as FlacInfo, b as FlacInfoError, I as IcoImageEntry,
|
|
1
|
+
export { E as ExifData, a as ExifError, F as FlacInfo, b as FlacInfoError, G as GifInfo, c as GifInfoError, I as IcoImageEntry, d as IcoInfo, e as IcoInfoError, f as Id3Tags, g as Id3TagsError, h as ImageFormat, i as ImageInfo, j as ImageInfoError, P as PdfMetadata, k as PdfMetadataError, l as PdfPageDimension, n as PdfPageDimensionsResult, o as PdfPageOrientation, V as VideoInfo, p as VideoInfoError, W as WavInfo, q as WavInfoError, r as inspectGifFrames, s as readExifData, t as readFlacInfo, u as readIcoInfo, v as readId3Tags, w as readImageInfo, x as readPdfMetadata, y as readPdfPageDimensions, z as readVideoInfo, A as readWavInfo } from '../media-BUvwm4wU.js';
|
package/dist/tools/media.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { readExifData, readFlacInfo, readIcoInfo, readId3Tags, readImageInfo, readPdfMetadata, readPdfPageDimensions, readVideoInfo, readWavInfo } from '../chunk-
|
|
1
|
+
export { inspectGifFrames, readExifData, readFlacInfo, readIcoInfo, readId3Tags, readImageInfo, readPdfMetadata, readPdfPageDimensions, readVideoInfo, readWavInfo } from '../chunk-226EH3ZI.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/network.cjs
CHANGED
|
@@ -2623,6 +2623,53 @@ function parseClientHintHeaders(rawHeaders) {
|
|
|
2623
2623
|
}
|
|
2624
2624
|
return { hints, unrecognized };
|
|
2625
2625
|
}
|
|
2626
|
+
function encodeRFC5987ValueChars(value) {
|
|
2627
|
+
return encodeURIComponent(value).replace(/[!'()*]/g, (c) => "%" + c.charCodeAt(0).toString(16).toUpperCase());
|
|
2628
|
+
}
|
|
2629
|
+
function buildContentDisposition(options = {}) {
|
|
2630
|
+
const type = options.type ?? "attachment";
|
|
2631
|
+
if (type !== "inline" && type !== "attachment") return { error: 'type must be "inline" or "attachment"' };
|
|
2632
|
+
if (!options.filename) return { header: type, type, filenameEncoded: false };
|
|
2633
|
+
const filename = options.filename;
|
|
2634
|
+
if (filename.includes("/") || filename.includes("\\")) return { error: "filename must not contain path separators" };
|
|
2635
|
+
const isAscii = /^[\x20-\x7e]*$/.test(filename);
|
|
2636
|
+
const asciiFallback = filename.replace(/[^\x20-\x7e]/g, "_").replace(/(["\\])/g, "\\$1");
|
|
2637
|
+
let header = `${type}; filename="${asciiFallback}"`;
|
|
2638
|
+
let filenameEncoded = false;
|
|
2639
|
+
if (!isAscii) {
|
|
2640
|
+
header += `; filename*=UTF-8''${encodeRFC5987ValueChars(filename)}`;
|
|
2641
|
+
filenameEncoded = true;
|
|
2642
|
+
}
|
|
2643
|
+
return { header, type, filename, filenameEncoded };
|
|
2644
|
+
}
|
|
2645
|
+
function parseContentDisposition(header) {
|
|
2646
|
+
if (typeof header !== "string" || header.trim() === "") return { error: "header is required" };
|
|
2647
|
+
const parts = header.split(";").map((p) => p.trim()).filter(Boolean);
|
|
2648
|
+
const type = parts[0]?.toLowerCase();
|
|
2649
|
+
if (!type) return { error: "Could not parse a disposition type from the header" };
|
|
2650
|
+
const params = {};
|
|
2651
|
+
for (let i = 1; i < parts.length; i++) {
|
|
2652
|
+
const eq = parts[i].indexOf("=");
|
|
2653
|
+
if (eq === -1) continue;
|
|
2654
|
+
const key = parts[i].slice(0, eq).trim().toLowerCase();
|
|
2655
|
+
let value = parts[i].slice(eq + 1).trim();
|
|
2656
|
+
if (value.startsWith('"') && value.endsWith('"')) value = value.slice(1, -1).replace(/\\(.)/g, "$1");
|
|
2657
|
+
params[key] = value;
|
|
2658
|
+
}
|
|
2659
|
+
let filename = params.filename;
|
|
2660
|
+
let filenameIsExtended = false;
|
|
2661
|
+
if (params["filename*"]) {
|
|
2662
|
+
const match = params["filename*"].match(/^([^']*)'([^']*)'(.*)$/);
|
|
2663
|
+
if (match) {
|
|
2664
|
+
try {
|
|
2665
|
+
filename = decodeURIComponent(match[3]);
|
|
2666
|
+
filenameIsExtended = true;
|
|
2667
|
+
} catch {
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
return { type, filename, filenameIsExtended, params };
|
|
2672
|
+
}
|
|
2626
2673
|
|
|
2627
2674
|
exports.CLIENT_HINTS = CLIENT_HINTS;
|
|
2628
2675
|
exports.DNS_RECORD_TYPES = DNS_RECORD_TYPES;
|
|
@@ -2634,6 +2681,7 @@ exports.STATUS_CODES = STATUS_CODES;
|
|
|
2634
2681
|
exports.analyzeEmailHeaders = analyzeEmailHeaders;
|
|
2635
2682
|
exports.buildCacheControl = buildCacheControl;
|
|
2636
2683
|
exports.buildClientHints = buildClientHints;
|
|
2684
|
+
exports.buildContentDisposition = buildContentDisposition;
|
|
2637
2685
|
exports.buildDnsQueryUrl = buildDnsQueryUrl;
|
|
2638
2686
|
exports.buildGeoUrl = buildGeoUrl;
|
|
2639
2687
|
exports.buildLinkHeader = buildLinkHeader;
|
|
@@ -2658,6 +2706,7 @@ exports.isValidIp = isValidIp;
|
|
|
2658
2706
|
exports.isValidIpv4 = isValidIpv4;
|
|
2659
2707
|
exports.isValidIpv6 = isValidIpv6;
|
|
2660
2708
|
exports.parseClientHintHeaders = parseClientHintHeaders;
|
|
2709
|
+
exports.parseContentDisposition = parseContentDisposition;
|
|
2661
2710
|
exports.parseContentRangeHeader = parseContentRangeHeader;
|
|
2662
2711
|
exports.parseDnsResponse = parseDnsResponse;
|
|
2663
2712
|
exports.parseGeoResponse = parseGeoResponse;
|
package/dist/tools/network.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, a as CacheControlDirective, b as CacheControlOptions, c as CacheControlResult, d as ClientHintDef, e as ClientHintValueType, f as ClientHintsBuildResult, g as ClientHintsParseResult, h as
|
|
1
|
+
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, a as CacheControlDirective, b as CacheControlOptions, c as CacheControlResult, d as ClientHintDef, e as ClientHintValueType, f as ClientHintsBuildResult, g as ClientHintsParseResult, h as ContentDispositionBuildOptions, i as ContentDispositionBuildResult, j as ContentDispositionParseResult, k as ContentRangeResult, l as CookieAttributes, m as CookieCheckResult, D as DNS_RECORD_TYPES, o as DnsRecord, p as DnsRecordType, q as DnsResponse, E as EmailHeaderAnalysis, r as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, s as HarEntry, t as HarParseResult, u as HarSummary, v as HeaderCategory, w as HttpHeader, I as Ipv6AddressType, x as Ipv6ParseResult, L as LINK_REL_VALUES, y as LinkHeaderEntry, z as LinkHeaderEntryInput, F as LinkHeaderResult, J as LinkRel, M as ManifestIconInfo, K as ManifestIssue, N as ManifestValidationResult, P as PERMISSIONS_POLICY_FEATURES, O as ParsedClientHint, Q as ParsedDnsResult, R as ParsedGeoResult, S as PermissionsPolicyDirective, T as PermissionsPolicyFeatureInput, U as PermissionsPolicyResult, V as REFERRER_POLICY_VALUES, W as RangeEntry, X as RangeEntryInput, Y as RangeHeaderResult, Z as ReceivedHop, _ as ReferrerPolicyEntry, $ as ReferrerPolicyResult, a0 as ReferrerPolicyValue, a1 as RobotsGroup, a2 as RobotsIssue, a3 as RobotsRule, a4 as RobotsValidationResult, a5 as STATUS_CODES, a6 as SameSiteValue, a7 as SitemapIndexEntry, a8 as SitemapIssue, a9 as SitemapUrlEntry, aa as SitemapValidationResult, ab as StatusCode, ac as UaDeviceType, ad as UserAgentInfo, ae as VaryHeaderEntry, af as VaryHeaderResult, ag as analyzeEmailHeaders, ah as buildCacheControl, ai as buildClientHints, aj as buildContentDisposition, ak as buildDnsQueryUrl, al as buildGeoUrl, am as buildLinkHeader, an as buildMapUrl, ao as buildPermissionsPolicy, ap as buildRangeHeader, aq as buildReferrerPolicy, ar as buildVaryHeader, as as checkSetCookieHeader, at as countryCodeToFlag, au as formatCoordinates, av as formatTtl, aw as getByCategory, ax as getHeader, ay as getHeadersByCategory, az as getStatusByCategory, aA as getStatusCode, aB as isClientError, aC as isServerError, aD as isSuccess, aE as isValidIp, aF as isValidIpv4, aG as isValidIpv6, aH as parseClientHintHeaders, aI as parseContentDisposition, aJ as parseContentRangeHeader, aK as parseDnsResponse, aL as parseGeoResponse, aM as parseHar, aN as parseIpv6Address, aO as parsePermissionsPolicy, aP as parseUserAgent, aQ as parseVaryHeader, aR as searchHeaders, aS as searchStatusCodes, aT as statusCodeToText, aU as typeNumberToLabel, aV as validateDomain, aW as validateHeaderName, aX as validateHeaderValue, aY as validateManifest, aZ as validateRobotsTxt, a_ as validateSitemap } from '../network-BG0XDx5W.cjs';
|
package/dist/tools/network.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, a as CacheControlDirective, b as CacheControlOptions, c as CacheControlResult, d as ClientHintDef, e as ClientHintValueType, f as ClientHintsBuildResult, g as ClientHintsParseResult, h as
|
|
1
|
+
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, a as CacheControlDirective, b as CacheControlOptions, c as CacheControlResult, d as ClientHintDef, e as ClientHintValueType, f as ClientHintsBuildResult, g as ClientHintsParseResult, h as ContentDispositionBuildOptions, i as ContentDispositionBuildResult, j as ContentDispositionParseResult, k as ContentRangeResult, l as CookieAttributes, m as CookieCheckResult, D as DNS_RECORD_TYPES, o as DnsRecord, p as DnsRecordType, q as DnsResponse, E as EmailHeaderAnalysis, r as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, s as HarEntry, t as HarParseResult, u as HarSummary, v as HeaderCategory, w as HttpHeader, I as Ipv6AddressType, x as Ipv6ParseResult, L as LINK_REL_VALUES, y as LinkHeaderEntry, z as LinkHeaderEntryInput, F as LinkHeaderResult, J as LinkRel, M as ManifestIconInfo, K as ManifestIssue, N as ManifestValidationResult, P as PERMISSIONS_POLICY_FEATURES, O as ParsedClientHint, Q as ParsedDnsResult, R as ParsedGeoResult, S as PermissionsPolicyDirective, T as PermissionsPolicyFeatureInput, U as PermissionsPolicyResult, V as REFERRER_POLICY_VALUES, W as RangeEntry, X as RangeEntryInput, Y as RangeHeaderResult, Z as ReceivedHop, _ as ReferrerPolicyEntry, $ as ReferrerPolicyResult, a0 as ReferrerPolicyValue, a1 as RobotsGroup, a2 as RobotsIssue, a3 as RobotsRule, a4 as RobotsValidationResult, a5 as STATUS_CODES, a6 as SameSiteValue, a7 as SitemapIndexEntry, a8 as SitemapIssue, a9 as SitemapUrlEntry, aa as SitemapValidationResult, ab as StatusCode, ac as UaDeviceType, ad as UserAgentInfo, ae as VaryHeaderEntry, af as VaryHeaderResult, ag as analyzeEmailHeaders, ah as buildCacheControl, ai as buildClientHints, aj as buildContentDisposition, ak as buildDnsQueryUrl, al as buildGeoUrl, am as buildLinkHeader, an as buildMapUrl, ao as buildPermissionsPolicy, ap as buildRangeHeader, aq as buildReferrerPolicy, ar as buildVaryHeader, as as checkSetCookieHeader, at as countryCodeToFlag, au as formatCoordinates, av as formatTtl, aw as getByCategory, ax as getHeader, ay as getHeadersByCategory, az as getStatusByCategory, aA as getStatusCode, aB as isClientError, aC as isServerError, aD as isSuccess, aE as isValidIp, aF as isValidIpv4, aG as isValidIpv6, aH as parseClientHintHeaders, aI as parseContentDisposition, aJ as parseContentRangeHeader, aK as parseDnsResponse, aL as parseGeoResponse, aM as parseHar, aN as parseIpv6Address, aO as parsePermissionsPolicy, aP as parseUserAgent, aQ as parseVaryHeader, aR as searchHeaders, aS as searchStatusCodes, aT as statusCodeToText, aU as typeNumberToLabel, aV as validateDomain, aW as validateHeaderName, aX as validateHeaderValue, aY as validateManifest, aZ as validateRobotsTxt, a_ as validateSitemap } from '../network-BG0XDx5W.js';
|
package/dist/tools/network.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildClientHints, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseClientHintHeaders, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap } from '../chunk-
|
|
1
|
+
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap } from '../chunk-S3OA5VCX.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilix-tech/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"description": "154+ developer utility tools for Node.js: JSON, encoding, hashing, color, CSS, network and more. Runs locally, no API key required.",
|
|
5
5
|
"author": "Utilix <hello@utilix.tech>",
|
|
6
6
|
"license": "MIT",
|