flake-idgen icon indicating copy to clipboard operation
flake-idgen copied to clipboard

ReferenceError: Buffer is not defined

Open VisionaryAppDev opened this issue 1 year ago • 0 comments

I tried to use this package in my Sveltekit project and got Buffer is not defined.

Here is my code:

  import FlakeId from "flake-idgen";
  import intformat from "biguint-format";

  const flakeIdGen = new FlakeId();
  let id = intformat(flakeIdGen.next(), "dec");

Here is my error log:

ReferenceError: Buffer is not defined
    at module.exports.next (flake-id-gen.js:58:13)
    at instance (MainComponent.svelte:11:49)
    at init (index.mjs:2165:11)
    at new MainComponent (MainComponent.svelte:24:23)
    at createProxiedComponent (svelte-hooks.js?v=8eec1919:341:9)
    at new ProxyComponent (proxy.js?v=8eec1919:242:7)
    at new Proxy<MainComponent> (proxy.js?v=8eec1919:349:11)
    at create_fragment (+page.svelte:12:97)
    at init (index.mjs:2180:37)
    at new Page (+page.svelte:141:20)

Not sure if this package will work in a Jamstack project.

VisionaryAppDev avatar Jun 05 '23 14:06 VisionaryAppDev