npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wasmzint

v1.0.1

Published

Zint WASM Bindings

Downloads

4

Readme

Zint WASM Bindings

Simple infrastructure and bindings to get the excellent Zint barcode generation library running in the browser via WebAssembly compiled with Emscripten.

Most features should be exposed by the bindings to get most barcode types and configurations to display, but not everything is exposed. The wrapper is farily thin though, so it should be straightforward to see what's going on. Pull requests welcome if you find something necesssary is missing.

Building

Linux: run build.sh (Full build with dependencies) or build_nodeps.sh (App build only, no building dependencies) Windows: build.bat or build_no_deps.bat Result: 3 types of results

  1. wasmzint.js and wasmzint.wasm - separate js and wasm files, can works only on the server.
  2. wasmzint_sf.js - wasm is embedded into the js file. Works locally or on a server.
  3. wasmzint_sf_es6.js - wasm is embedded into the es6 module. Convenient to use for the import directive

build_dependencies.sh (called by build.sh) and build_deps.bat (for windows) handles passing proper arguments to the dependency projects and building dependencies. Dependencies are pulled in via Git submodules in the /deps directory.

Using

  1. Connection via html:
  • include script into html file
<script src="./wasmzint_sf.js"></script>
  • Init wasmzint and use:
    wasmzint().then(function (Module) {
    const instance = new Module.ZintWrapper()
    const out = instance.encodeAndPrint({symbology: BARCODE_EANX, scale: 1.5,
                  height: 50, fgcolour: '006400', outfile: 'out.svg'},
                 '123456789012+12345')
    const version = instance.version()
    })

See the example drawing to a canvas in demo.html.

  1. Connection via import module
   import wasmzint from "./wasmzint_sf_es6.js"

    ...
   try {
        zintModule = await wasmzint()
        zintInstance = new zintModule.ZintWrapper()
   }
   catch(e){
   }

Functions

  1. encodeAndPrint(params, data) Call zint function ZBarcode_Encode_and_Print
  2. encodeAndVector(params, data) Call zint function ZBarcode_Encode_and_Buffer_Vector
  3. encodeAndBuffer(params, data) Call zint function ZBarcode_Encode_and_Buffer
  4. barcodeName(symbol_id) Call zint function ZBarcode_BarcodeName
  5. cap(symbol_id, flags) Call zint function ZBarcode_Cap
  6. defaultXdim(symbol_id) Call zint function ZBarcode_Default_Xdim
  7. scaleFromXdimDp(symbol_id, x_dim_mm, dpmm, filetype) Call zint function ZBarcode_Scale_From_XdimDp
  8. xdimDpFromScale(symbol_id, scale, x_dim_mm_or_dpmm, filetype) Call zint function ZBarcode_XdimDp_From_Scale
  9. version() Call zint function ZBarcode_Version

...coming soon