MCPcopy
hub / github.com/gchq/CyberChef / extractPDF

Function extractPDF

src/core/lib/FileSignatures.mjs:2844–2854  ·  view source on GitHub ↗
(bytes, offset)

Source from the content-addressed store, hash-verified

2842 * @returns {Uint8Array}
2843 */
2844export function extractPDF(bytes, offset) {
2845 const stream = new Stream(bytes.slice(offset));
2846
2847 // Find end-of-file marker (%%EOF)
2848 stream.continueUntil([0x25, 0x25, 0x45, 0x4f, 0x46]);
2849 stream.moveForwardsBy(5);
2850 stream.consumeIf(0x0d);
2851 stream.consumeIf(0x0a);
2852
2853 return stream.carve();
2854}
2855
2856
2857/**

Callers

nothing calls this directly

Calls 4

continueUntilMethod · 0.95
moveForwardsByMethod · 0.95
consumeIfMethod · 0.95
carveMethod · 0.95

Tested by

no test coverage detected