Socket
Socket
Sign inDemoInstall

uuid-wasm

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    uuid-wasm

A WebAssembly implementation of UUID v1 generator and parser


Version published
Weekly downloads
52
decreased by-27.78%
Maintainers
1
Install size
63.8 MB
Created
Weekly downloads
 

Readme

Source

uuid-wasm

Version Documentation Maintenance License: MIT

A WebAssembly implementation of UUID v1 generator and parser

Supports both ESM an CommonJS

🏠 Homepage

About

The Fastest UUID v1 Parser and Generator for NodeJS.

The results were obtained by running each function inconsistently 1,000,000 times with NodeJS v20.8.1, R7 6800H, 16g DDR5

Parsing (string --> Data)Average, opsMedian, ops
uuid-wasi@0.2.0 unsafe4,414,844 ± 4.27 %4,524,905 ± 5.26 %
uuid-wasi@0.2.0 safe3,884,245 ± 2.24 %3,984,022 ± 2.46 %
uuid@9.0.0----------
cassandra-driver@4.6.4906,154 ± 5.43 %924,215 ± 6.76 %

Generate (--> string)Average, opsMedian, ops
uuid-wasi@0.2.06,516,927 ± 10.13 %6,584,145 ± 12.64 %
uuid@9.0.03,705,620 ± 7.15 %3,785,155 ± 9.99 %
cassandra-driver@4.6.4278,435 ± 6.48 %286,600 ± 9.92 %

Prerequisites

  • node >=14.21.3

Install

npm i uuid-wasm

Usage

import { InitUUID } from 'uuid-wasm';

const run = async () => {
    const { v1, nanos, timeFromV1, unsafeTimeFromV1 } = await InitUUID();

    const uuid = v1();
    console.log(uuid);
    // 6335ff92-6a7a-11ee-929a-eedc63b9d38e

    const nanoseconds = nanos();
    console.log(nanoseconds);
    // 1697278437810573000n

    const date1 = timeFromV1(uuid);
    console.log(date1);
    // 2023-10-14T10:13:57.810Z
    console.log(date1.getTime());
    // 1697278547627

    const date2 = unsafeTimeFromV1(uuid);
    console.log(date2);
    // 2023-10-14T10:13:57.810Z
    console.log(date2.getTime());
    // 1697278547627
};

run().catch(console.error);

Author

Sergey Saltykov

Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

License

Copyright © 2023 Sergey Saltykov.
This project is MIT licensed.

Keywords

FAQs

Last updated on 15 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc