0.9.3 • Published 8 months ago

@dotpostcard/postcards v0.9.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Postcards

A low-level typescript library for reading .postcard files in the browser.

If you want to display a .postcard file on a webpage, use the postcard-html web component.

Usage

import { Postcard, fetchPostcard } from '@dotpostcard/postcards'

const run = async (postcardFileUrl) => {
  const pc: Postcard = await fetchPostcard(postcardFileUrl)

  console.log(pc.metadata.size.front())
  // { w: "14.8cm", h: "10.5cm" }
  console.log(pc.metadata.description)
  // { "en-GB": "A polaroid-style framed photo of the Palacio de Cristal in Madrid's Retiro Park in Autumn." }

  const frontData: Uint8Array = await pc.frontData
  const frontUrl: string = URL.createObjectURL(new Blob([frontData]))

  // Show the image on a page
  document.getElementsByTagName('img')[0].src = frontUrl
}

run('https://raw.githubusercontent.com/dotpostcard/postcards-go/main/fixtures/hello.postcard')
0.9.3

8 months ago

0.9.0

9 months ago

0.9.2

8 months ago

0.9.1

8 months ago

0.8.0

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

1.0.0

2 years ago

0.3.1

2 years ago

0.2.3

2 years ago