Small utility for dealing with files in tests. Only use in tests!
import kitchenfile from 'kitchenfile'
const file = kitchenfile(`${__dirname}/files`)
// or: const file = kitchenfile(__dirname, files)
// Calls to file() are memoized!
file('image.jpg').rs() // returns a readable stream
file('image.jpg').buf // returns a buffer
file('image.jpg').path // path to image.jpg
file('image.jpg').contentType // content type based on file ext (e.g. image/jpg)
file('image.jpg').size // file size in bytes
file('image.jpg').filename // => image.jpg
npm install --save-dev kitchenfile
Requires Node v6+
See ./test directory for usage examples.