1.0.1 • Published 2 years ago

streamer-fs v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

fs-stream

It is a file copier using only one stream!

Example

import { send, receive } from "streamer-fs"
import { pipeline } from "stream/promises"

await pipeline(
    await send("files", async (file) => {
      const res = !fs.existsSync(path.join("copied", file))
      if (res) {
        console.log(file)
      }
      return res
    }),
    receive("copied")
  )
  • "files" and "copied" are directory names.
  • "send" can have second argument callback function which receives filepath as argument, you can return false to skip the file.