Skip to content

Commit

Permalink
import fs dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnaveen committed Sep 14, 2023
1 parent ef15aaf commit 874371b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fetch from "node-fetch";
import fs from "fs";
import { encode } from "blurhash";
import sharp from 'sharp';
import sizeOf from "image-size";
Expand Down Expand Up @@ -42,6 +41,7 @@ export const blurhashFromURL = async (source: string, options: IOptions = {}): P
let width, height, returnedBuffer;

if (offline) {
const fs = await import("fs");
const { width: localWidth, height: localHeight } = sizeOf(source);
width = localWidth;
height = localHeight;
Expand Down

0 comments on commit 874371b

Please sign in to comment.