All Projects → philippfranke → Multipart Related

philippfranke / Multipart Related

Licence: bsd-3-clause
MIME multipart/related as defined in RFC 2387

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Multipart Related

Drive Cli
A command line interface for accessing google drive
Stars: ✭ 449 (+4390%)
Mutual labels:  google, google-drive
Plexidrive
Scripts to facilitate the use of cloud storage (such as Google Drive) as storage for Plex media server
Stars: ✭ 118 (+1080%)
Mutual labels:  google, google-drive
Googledriveuploadtool
A tool for Windows to upload and manage files in Google Drive. It resumes uploads in case of an error or failure. Perfect for uploading large files or if your connection is unstable.
Stars: ✭ 58 (+480%)
Mutual labels:  google, google-drive
Psgsuite
Powershell module for Google / G Suite API calls wrapped in handy functions. Authentication is established using a service account via P12 key to negate the consent popup and allow for greater handsoff automation capabilities
Stars: ✭ 184 (+1740%)
Mutual labels:  google, google-drive
Google Drive For Mac
A standalone macOS app for Google Docs, Sheets and Slides
Stars: ✭ 202 (+1920%)
Mutual labels:  google, google-drive
Gcsf
a FUSE file system based on Google Drive
Stars: ✭ 2,251 (+22410%)
Mutual labels:  google, google-drive
Gindex V4
A Vue Js Based G Index with Improved Dark Mode, Search and Video Player
Stars: ✭ 143 (+1330%)
Mutual labels:  google, google-drive
Gam
command line management for Google Workspace
Stars: ✭ 2,558 (+25480%)
Mutual labels:  google, google-drive
Gdrivefs
An innovative FUSE wrapper for Google Drive.
Stars: ✭ 618 (+6080%)
Mutual labels:  google, google-drive
Googleads Mobile Unity
Official Unity Plugin for the Google Mobile Ads SDK
Stars: ✭ 837 (+8270%)
Mutual labels:  google
Began Tensorflow
Tensorflow implementation of "BEGAN: Boundary Equilibrium Generative Adversarial Networks"
Stars: ✭ 904 (+8940%)
Mutual labels:  google
Sketch Map Generator
Sketch plugin to fill a shape with a map generated from a given location using Google Maps and Mapbox
Stars: ✭ 824 (+8140%)
Mutual labels:  google
Ct gdrive
Lustre/HSM Google Drive copytool
Stars: ✭ 16 (+60%)
Mutual labels:  google-drive
Fsfirestore
Functional F# library to access Firestore database hosted on Google Cloud Platform (GCP) or Firebase.
Stars: ✭ 22 (+120%)
Mutual labels:  google
Tensorlayer
Deep Learning and Reinforcement Learning Library for Scientists and Engineers 🔥
Stars: ✭ 6,796 (+67860%)
Mutual labels:  google
Drivebackupv2
Uploads Minecraft backups to Google Drive/OneDrive or by (S)FTP
Stars: ✭ 26 (+160%)
Mutual labels:  google-drive
Youtubeux
With MVVM Architecture pattern using Android Architecture Components This is a sample app demonstrating Youtube player animation using constraint layout
Stars: ✭ 823 (+8130%)
Mutual labels:  google
Play Authenticate
An authentication plugin for Play Framework 2.x (Java)
Stars: ✭ 813 (+8030%)
Mutual labels:  google
Fontsource
Self-host Open Source fonts in neatly bundled NPM packages.
Stars: ✭ 836 (+8260%)
Mutual labels:  google
Geocoder
🌎 GoLang package that provides an easy way to use the Google Geocoding API
Stars: ✭ 23 (+130%)
Mutual labels:  google

multipart-related

multipart-related implements MIME multipart/related in go, RFC 2387

Documentation: GoDoc

Build Status: Build Status

Test Coverage: Coverage Status

multipart-related requires Go version 1.2 or greater.

What is multipart-related

The Package related implements MIME multipart/related parsing, as defined in RFC 2387.

See Wikipedia:

A multipart/related is used to indicate that each message part is a component of an aggregate whole. It is for compound objects consisting of several inter-related components - proper display cannot be achieved by individually displaying the constituent parts. The message consists of a root part (by default, the first) which reference other parts inline, which may in turn reference other parts. Message parts are commonly referenced by the "Content-ID" part header. The syntax of a reference is unspecified and is instead dictated by the encoding or protocol used in the part.

One common usage of this subtype is to send a web page complete with images in a single message. The root part would contain the HTML document, and use image tags to reference images stored in the latter parts.

Compatible with Google's Drive REST API

Usage

import "github.com/philippfranke/multipart-related/related"

Writer

content := []byte(`Life? Don't talk to me about life!`)   // Douglas Adams, The Hitchhiker's Guide to the Galaxy
var b bytes.Buffer
w := related.NewWriter(&b)

rootPart, err := w.CreateRoot("[email protected]", "H2/G2", nil)
if err != nil {
  panic(err)
}

rootPart.Write(content[:5])

nextPart, err := w.CreatePart("", nil)
if err != nil {
  panic(err)
}
nextPart.Write(content[5:])

if err := w.Close(); err != nil {
  panic(err)
}

fmt.Printf("The compound Object Content-Type:\n %s \n", w.FormDataContentType())
fmt.Fprintf(os.Stdout, "Body: \n %s", b.String())

Reader

header := `multipart/related; boundary=example-1;
                start="<[email protected]>";
                type="a/b"`

msg := strings.NewReader(`--example-1
Content-Type: a/b
Content-ID: <[email protected]>

Life?
--example-1
Content-Type: b/c
Content-Transfer-Encoding: base64
Content-ID: <[email protected]>

RG9uJ3QgdGFsayB0byBtZSBhYm91dCBsaWZlIQ==

--example-1--`)

  mediaType, params, err := mime.ParseMediaType(header)
  if err != nil {
    panic(err)
  }
  if mediaType != "multipart/related" {
    panic(nil)
  }

  r := related.NewReader(msg, params)
  object, err := r.ReadObject()
  if err != nil {
    panic(err)
  }
  for i, part := range object.Values {
    b, err := ioutil.ReadAll(part)
    if err != nil {
      panic(err)
    }
    fmt.Printf("%d.: %s \n", i, string(b))
  }

License

This library is distributed under the BSD-style license found in the LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].