@typed/content-hash
Version:
Content hash a directory of HTML/JS/CSS files and other static assets
26 lines (19 loc) • 613 B
text/typescript
import { Do } from '@typed/fp/FxEnv'
import { isSome, none } from 'fp-ts/Option'
import { debug } from '../application/services/logging'
import { HashPlugin } from './HashPlugin'
export function createReadFilePath(plugins: readonly HashPlugin[]) {
return function readFilePath(filePath: string) {
const eff = Do(function* (_) {
yield* _(debug(`Reading ${filePath}...`))
for (const plugin of plugins) {
const document = yield* _(plugin.readFilePath(filePath))
if (isSome(document)) {
return document
}
}
return none
})
return eff
}
}