Skip to content

Instantly share code, notes, and snippets.

@maciejcieslar
Last active November 9, 2018 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maciejcieslar/f3217ddc9dd86d6ec5dc770fec450579 to your computer and use it in GitHub Desktop.
Save maciejcieslar/f3217ddc9dd86d6ec5dc770fec450579 to your computer and use it in GitHub Desktop.
fromEvent(chokidar.watch(process.cwd()), 'all').pipe(
// ...
map(([event, filePath]: string[]) => {
const filename = path.basename(filePath)
const extension = path.extname(filename)
return {
event,
filename,
extension,
filePath: filePath.slice(process.cwd().length + 1),
}
}),
// ...
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment