Skip to content

Commit

Permalink
use Glob
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Feb 2, 2024
1 parent 0fb66bb commit c5cf0ba
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const os = require('node:os')
const { fileURLToPath } = require('node:url')
const { readFile } = require('node:fs/promises')
const { statSync } = require('node:fs')
const { Glob, globSync } = require('glob')
const { Glob } = require('glob')
const fp = require('fastify-plugin')
const send = require('@fastify/send')
const encodingNegotiator = require('@fastify/accept-negotiator')
Expand Down Expand Up @@ -150,11 +150,9 @@ async function fastifyStatic (fastify, opts) {
rootPath += '/'
}

const files = globSync('**/**', {
for (let file of new Glob('**/**', {
cwd: rootPath, absolute: false, follow: true, nodir: true, dot: opts.serveDotFiles
})

for (let file of files) {
})) {
file = file.split(path.win32.sep).join(path.posix.sep)
const route = opts.hash ? getHashedAsset(file) : prefix + file

Expand Down

0 comments on commit c5cf0ba

Please sign in to comment.