diff --git a/index.js b/index.js index 86b47dc..3caa81d 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ const path = require('node:path') const { fileURLToPath } = require('node:url') const { statSync } = require('node:fs') -const { glob } = require('glob') +const { glob } = require('node:fs/promises') const fp = require('fastify-plugin') const send = require('@fastify/send') const encodingNegotiator = require('@fastify/accept-negotiator') @@ -139,9 +139,10 @@ async function fastifyStatic (fastify, opts) { for (let rootPath of roots) { rootPath = rootPath.split(path.win32.sep).join(path.posix.sep) !rootPath.endsWith('/') && (rootPath += '/') - const files = await glob('**/**', { + + const files = await Array.fromAsync(glob('**/**', { cwd: rootPath, absolute: false, follow: true, nodir: true, dot: opts.serveDotFiles, ignore: opts.globIgnore - }) + })) for (let file of files) { file = file.split(path.win32.sep).join(path.posix.sep) diff --git a/out.txt b/out.txt new file mode 100644 index 0000000..05f2113 Binary files /dev/null and b/out.txt differ diff --git a/package.json b/package.json index 011daf5..1d5e6a2 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,7 @@ "@fastify/send": "^4.0.0", "content-disposition": "^0.5.4", "fastify-plugin": "^5.0.0", - "fastq": "^1.17.1", - "glob": "^11.0.0" + "fastq": "^1.17.1" }, "devDependencies": { "@fastify/compress": "^8.0.0",