Random bytes for the browser or node
npm install @bicycle-codes/randombytesGet random bytes as a Uint8Array, using the same API in either Node or browsers.
Under the hood this will use the node:crypto library if used in node, or crypto.getRandomValues in the browser.
Contents
- install
- API
* ESM
* Common JS
- CSS
* Import CSS
* Customize CSS via some variables
- use
* JS
* pre-built JS
Installation instructions
``sh`
npm i -S @namespace/package
This exposes ESM and common JS via package.json exports field.
js
import '@namespace/package/module'
`$3
`js
require('@namespace/package/module')
`CSS
$3
`js
import '@namespace/package-name/css'
`Or minified:
`js
import '@namespace/package-name/css/min'
`$3
`css
component-name {
--example: pink;
}
`use
usage instructions here$3
`js
import '@namespace/package/module'
`$3
This package exposes minified JS files too. Copy them to a location that is
accessible to your web server, then link to them in HTML.#### copy
`sh
cp ./node_modules/@namespace/package/dist/module.min.js ./public
`#### HTML
`html
``