{"schema_version":"1.0","publisher":"Primitive SDKs","canonical_url":"https://test.abhinandan.one/node-sdk-attachment-bundling","markdown_url":"https://test.abhinandan.one/node-sdk-attachment-bundling.md","article":{"id":"612f5616-2b2a-4649-b5fd-889aced4e6d9","article_slug":"node-sdk-attachment-bundling","parent_article_slug":null,"parent_article_title":null,"kind":"guide","published_at":"2026-08-11T18:54:53.453+00:00","keywords":["bundleAttachments","tar.gz attachment bundle","content-addressed archive","ParsedData attachments","parseEmail attachments","@primitivedotdev/sdk/parser"],"meta_description":"Bundle attachments extracted from a parsed email into a single content-addressed tar.gz archive using the Node.js SDK's parser subpath.","og_image_url":null,"source_file_paths":[],"recording_id":null,"replayable":false,"task_name":"Bundling Attachments","category":"Node.js SDK","summary":null,"description":"Package the downloadable attachments extracted from a parsed email into a single content-addressed tar.gz archive, useful when you need one artifact to store or hand off instead of many individual files.","content_kind":"repo_page","content_markdown":"Bundling packages downloadable attachments extracted from a parsed email into a single content-addressed `tar.gz` archive for storage. Reach for it when you want one artifact to archive or hand off instead of many loose attachment files.\n\n<Note>\n\nBundling is for attachments you have already pulled out of a parsed email. It is not how you send or receive large attachments over the wire, that is [Primitive Payloads](node-sdk-payloads), which streams content-addressed, end-to-end-encrypted objects with `pushFile`, `pushBytes`, and `pullFile`.\n\n</Note>\n\n## Where bundling lives in the SDK\n\nBundling is part of the Node-only `parser` surface of `@primitivedotdev/sdk`, alongside the raw MIME helpers. The `contract` and `parser` subpaths are Node-only modules, so they are not available in the Workers-safe `/api` entry point used inside Primitive Functions.\n\n<Warning>\n\nDo not import the `parser` subpath into a Primitive Function handler. Function handlers should import from `@primitivedotdev/sdk/api`, which is the Workers-safe entry point.\n\n</Warning>\n\n## What you need first\n\nBundling consumes attachments that have already been extracted from a raw MIME message, so parse the message before you bundle. [Parsing Raw Email (.eml)](node-sdk-parsing-email) covers the `parser` subpath and the address helpers it exports.\n\n## Bundle versus Primitive Payloads\n\nBundling produces a stored archive; Primitive Payloads delivers a large attachment as part of an email. Both are content-addressed, but they solve different problems.\n\n| Goal | Use |\n| --- | --- |\n| Archive several already-extracted attachments as one file | Bundling (`parser` subpath) |\n| Deliver an attachment larger than the inline cap on a send | [Primitive Payloads](node-sdk-payloads) |\n| Attach small files directly on `send`/`reply`/`forward` | Inline `attachments` with `content_base64` ([Sending, Replying, and Forwarding Email](node-sdk-sending-email)) |\n\n<Tip>\n\nIf the file needs to reach the recipient rather than your own storage, skip bundling. Upload it with `pushFile` or `pushBytes` and deliver it by reference, as described in [Primitive Payloads: Streaming Large Attachments](node-sdk-payloads).\n\n</Tip>\n\n## Next steps\n\n<CardGroup cols={2}>\n\n<Card title=\"Parsing Raw Email (.eml)\" href=\"node-sdk-parsing-email\">\n\nProduce the parsed message that bundling consumes.\n\n</Card>\n\n<Card title=\"Primitive Payloads: Streaming Large Attachments\" href=\"node-sdk-payloads\">\n\nUpload and reference large attachments instead of bundling them.\n\n</Card>\n\n<Card title=\"Sending, Replying, and Forwarding Email\" href=\"node-sdk-sending-email\">\n\nAttach files inline or by reference when sending outbound mail.\n\n</Card>\n\n<Card title=\"Node.js SDK Agent Guide\" href=\"node-sdk-agent-guide\">\n\nLook up every import path and method signature in one dense reference.\n\n</Card>\n\n</CardGroup>","canonical_base_url":"https://test.abhinandan.one","seo_indexing_enabled":true,"last_modified":"2026-08-21T18:22:43.359885+00:00","video_url":null,"voiceover_url":null,"tools_used":[],"demonstrated_by":[],"steps":[],"related_links":[],"intro":null,"prerequisites":[],"verification":[],"troubleshooting":[],"suggest_edit_url":null,"raise_issue_url":"https://github.com/abhi-browzer/primitive-sdks/issues/new?title=Docs+feedback%3A+Bundling+Attachments&body=Page%3A+https%3A%2F%2Ftest.abhinandan.one%2Fnode-sdk-attachment-bundling","page_feedback_enabled":true,"verified_ref":null,"verified_at":"2026-08-11T18:38:45.205849+00:00"}}