Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including pwgen with all npm packages installed. Try it out:

var pwgen = require("pwgen")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

pwgen v1.1.0

A password generator compiled as Wasm for use on the CLI, in a custom element, or as a module.

pwgen

A password generator compiled as Wasm for use on the CLI, in a custom element, or as a module.

Use on the CLI with Mac, Windows, and Linux

npm version wapm version

With npx

npx pwgen -sy 20 1

With npm, as a global package

npm i -g pwgen
pwgen -sy 20 1

With wapm

wapm install kherrick/pwgen

wapm run pwgen -sy 20 1

Use as a custom element

With default options (demo)

<x-pwgen></x-pwgen>

<script type="module">
  import 'https://unpkg.com/pwgen'
</script>

With additional options and detail logging (demo)

<x-pwgen composed flags="-sy" length="20" number="1"></x-pwgen>

<script type="module">
  import 'https://unpkg.com/pwgen'

  document.addEventListener(
    'x-pwgen-handle-password',
    ({ detail }) => {
      console.log(detail.msg)
    }
  )
</script>

Use in React

npm i pwgen
import React from 'react';
import 'pwgen';

const App: React.FC = () => {
  return (
    <x-pwgen></x-pwgen>
  )
}

Use from Node.js

const pwgen = require('pwgen')

const flags = '-1sy'
const length = '20'
const number = '10'

pwgen({ arguments: [ flags, length, number ], print: stdout => {
  console.log(`Password: ${stdout}`)
}})

Test the experimental web bundle

Download pwgen.wbn

Read more about web packaging

Develop

Requirements

Clone the project and submodules

git clone https://github.com/kherrick/pwgen && \
  cd pwgen && \
  git submodule update --init --recursive

Start

npm start

Build Wasm

npm run build:node && \
  npm run build:browser

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free